MySQL Forums
Forum List  »  Optimizer & Parser

Re: Why isn't the index being used?
Posted by: Jim Daemon
Date: June 13, 2006 08:41AM

You are correct in that there will only be 1 record returned because there will only be 1 record for the particular session id being asked for. The table currently has a little over 100,000 records.

The limit clause was put on there by PHPMyAdmin when I was doing the EXPLAIN but is not actually part of my query. I apologize for neglecting to remove that part.

It was my understanding that if the index isn't being used, then the entire table is scanned for the matching record. If the index is used, then a table scan is avoided.

Is the above correct or was I mis-informed?

Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a person does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses their intelligence.



Edited 1 time(s). Last edit at 06/13/2006 08:42AM by Jim Daemon.

Options: ReplyQuote


Subject
Views
Written By
Posted
3347
June 12, 2006 06:11PM
1895
June 12, 2006 06:41PM
Re: Why isn't the index being used?
2153
June 13, 2006 08:41AM
1932
June 13, 2006 09:11AM
1951
June 13, 2006 09:54AM
1954
June 13, 2006 04:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.