MySQL Forums
Forum List  »  Performance

Re: Index usage for ORDER BY / LIMIT?
Posted by: Daniel Nichter
Date: June 14, 2005 01:45PM

There is a way to tell if it's scanning the index or table: The type column of EXPLAIN. If it's a table scan it will be type: ALL, if index scan, type: index (as in this case). This makes sense because you're selecting the whole table (i.e., no WHERE restriction), which MySQL would not normally use an index for (hence possible_keys: NULL), but in this case MySQL realizes that index i_date can be used to satisfy the query anyway. In addition to doing an index scan, MySQL is getting values from the index in RAM ("Using index"), so it's not even touching the hard drive. For a just a few thousand rows, this should be very fast.

Options: ReplyQuote


Subject
Views
Written By
Posted
2152
June 14, 2005 11:34AM
Re: Index usage for ORDER BY / LIMIT?
1486
June 14, 2005 01:45PM


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.