[dev] SQL updates (was Re: Redundant index in table mnemo_memos?)
Duck
duck at obala.net
Tue Aug 22 02:13:02 PDT 2006
On Tuesday 22 August 2006 07:46, Chuck Hagenbuch wrote:
> Looking at the code, most of the time we query on both ticket_id and
> ticket_owner; sometimes just on ticket_id. So does changing it to use:
> PRIMARY KEY (ticket_id, ticket_owner) ... sound right?
>
Indexes should flow data logic. So in this case the PRIMARY KEY (ticket_id,
ticket_owner) should be right. This will benefit even of a second database
unique check. I will create the same index type for other tables without
indexes.
And is really not a problem if we accessing only one part of index. Mysql
will use only the needed part. Since combined index in selection
are “ungrouped” and taken separately. It will use all the indexes or their
pars needed for the query.
Duck
More information about the dev
mailing list