List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:September 6 2005 10:56pm
Subject:Re: trouble understanding why query is not using the index.
View as plain text  
In the last episode (Sep 06), Jason Pyeron said:
> there is an unique key index 'pathref_2 (pathref,version)' on this
> table.
> 
> so why does 'explain select * from files where 
> (pathref,version)=(129286,0);' scan the whole table?

I have to admit I have never seen this syntax used in a where clause
before.  Does "where pathref=129286 and version=0" optimize any better? 
A quick test of mysql-5.0.11 indicates that it doesn't use indexes at
all with the (field1,field2,..)=(value1,value2,..) syntax.  Feel free
to file a bug :)

-- 
	Dan Nelson
	dnelson@stripped
Thread
trouble understanding why query is not using the index.Jason Pyeron7 Sep
  • Re: trouble understanding why query is not using the index.Dan Nelson7 Sep
    • Re: trouble understanding why query is not using the index.Jason Pyeron7 Sep
      • Re: trouble understanding why query is not using the index.Gleb Paharenko7 Sep
        • Re: trouble understanding why query is not using the index.Jason Pyeron7 Sep
          • Re: trouble understanding why query is not using the index.Gleb Paharenko8 Sep