[dev] Redundant index in table mnemo_memos?

Chuck Hagenbuch chuck at horde.org
Fri Aug 18 15:56:55 PDT 2006


Quoting Luciano Ramalho <luciano at ramalho.org>:

> In the definition of table mnemo_memos we have:
>
>    PRIMARY KEY (memo_owner, memo_id)
>
> and then
>
>    CREATE INDEX mnemo_notepad_idx ON mnemo_memos (memo_owner);
>
> When I look at that table structure in phpMyAdmin, it warns:
>
>    PRIMARY and INDEX keys should not both be set for column `memo_owner`
>
> I've read somewhere that having an index on the same field  
> (memo_owner in this case) that leads a primary key is redundant, at  
> least in MySQL.

Yup, sure looks like it. What we should have is an index on the  
memo_id field. I think I'd prefer to leave the memo_owner index and to  
make the primary key just memo_id. This would go along with something  
else I want to do for Nag, Kronolith, and Turba as well as Mnemo,  
which is to make all of the _id fields integers again (they became  
long strings when we thought we needed them to be uids, but then we  
realized the uids had to be seperate anyway).

Any objections?

-chuck

-- 
"we are plastered to the windshield of the bus that is time." - Chris


More information about the dev mailing list