List:General Discussion« Previous MessageNext Message »
From:Corin Langosch Date:December 9 2003 9:27am
Subject:Re[2]: key is not used
View as plain text  
Hello,

thanks for your fast reply. even when i use
EXPLAIN SELECT * FROM `actions` ORDER BY datum LIMIT 10
the key isn't used. the query takes about 2s :-(

Corin

Tuesday, December 9, 2003, 10:19:16 AM, you wrote:
MT> Hi,

MT> I'm not saying I fully understand the MySQL optimizer, as
MT> I never had to deal with it before... but:

MT> Why should it use an index if the statement is returning ALL
MT> rows? It might be faster to read them into memory ( 75853
MT> isn't really much ) and sort them there instead of moving the
MT> diskhead back and forth between the index and the data.

>> i'm having a problem with mysql. when i put an index on a
>> datetime column, it's never used.
>>
>> for example the
>> sql: 'EXPLAIN SELECT * FROM actions ORDER BY datum'
>>
>> shows:
>> table  type  possible_keys  key  key_len  ref  rows  Extra
>> actions ALL NULL NULL NULL NULL 75853 Using filesort
>>
>> even if i use the
>> sql: 'EXPLAIN SELECT * FROM actions USE INDEX (datum) ORDER BY datum'
>>
>> mysql doesn' use the index :-((

MT> With regards,

MT> Martijn Tonies
MT> Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
MT> Server.
MT> Upscene Productions
MT> http://www.upscene.com



Thread
key is not usedCorin Langosch9 Dec
  • Re: key is not usedMartijn Tonies9 Dec
    • Re[2]: key is not usedCorin Langosch9 Dec
      • Re: key is not usedChuck Gadd9 Dec
  • update: key is not usedCorin Langosch9 Dec
    • Re: update: key is not usedEgor Egorov9 Dec
  • Re: Re[2]: key is not usedMartijn Tonies9 Dec