On Wed, 20 Nov 2002, Joseph Bueno wrote: > Fabrizio Nesti wrote: > > > > Why this simple query does not use the PRIMARY key (which is oai_ui)? > > > > mysql> explain select * from idb_metadata where oai_ui like 'doi:10.1088/0%'; > > > While this is correctly using it.... > > mysql> explain select oai_ui from idb_metadata where oai_ui like 'doi:10.1088/0%'; > > >+--------------+-------+---------------+---------+---------+------+--------+-------------------------+ > > | table | type | possible_keys | key | key_len | ref | rows | Extra > | > > >+--------------+-------+---------------+---------+---------+------+--------+-------------------------+ > > | idb_metadata | range | PRIMARY | PRIMARY | 50 | NULL | 137387 | where >used; Using index | > > >+--------------+-------+---------------+---------+---------+------+--------+-------------------------+
> "In some cases a query can be optimised to retrieve values without > consulting the datafile. If all used columns for some table are numeric > and form a leftmost prefix for some key, the values may be retrieved > from the index tree for greater speed:" Thanks! Of course I read the manual... without actually reading. :) On the second sentence, how does it apply, since the key is not numeric (varchar)? Thanks again, so I suppose we just have to LIMIT it. Fabrizio --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php