MySQL index question

Jeffrey L. Taylor
Tue, 20 Jul 2010 14:12:37 -0000

I am trying to speed up some DB operations and perhaps have gone overboard
with indexes.  Does MySQL usually use only one index per query and simply
match keys on the results of the indexed first part?  For example:

DELETE FROM tokens WHERE 6813946236211560448 <= fnv AND fnv <
6818449835838930944 AND updated_at<''2010-06-20 14:08:55''
AND occurrences=0;

If I understand correctly from the output of:

EXPLAIN SELECT * FROM tokens WHERE 6813946236211560448 <= fnv AND fnv <
6818449835838930944 AND updated_at<''2010-06-20 14:08:55''
AND occurrences=0;

only the index on fnv is used (there are indexes on updated_at and
occurrences).

Is this correct?

TIA,
  Jeffrey

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org