[dev] Redundant index in table mnemo_memos?

Jan Schneider jan at horde.org
Sat Aug 19 01:19:29 PDT 2006


Zitat von Chuck Hagenbuch <chuck at horde.org>:

> 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`

This warning is bogus and will be removed in future versions.

>> 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.

Not quite, see the recent index changes in horde_prefs.

> 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?

No.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list