List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 4 2002 3:04am
Subject:Re: WHERE clause efficiency
View as plain text  
At 10:43 +0800 10/4/02, Niclas Hedhman wrote:
>If I have a table,
>
>Name VARCHAR(100)
>L  DOUBLE
>a DOUBLE
>b DOUBLE
>
>and execute the incredible
>
>SELECT * FROM Colors WHERE
>SQRT(
>   SQ(
>     ABS( L - 45.5 ) 
>   ) +
>   SQ(
>     ABS( a - 13.2 ) 
>   ) +
>   SQ(
>     ABS( b + 23.4 ) 
>   )
>)  < 2.5 ;
>
>Could MySQL benefit in any way by indexing the L,a,b fields? Or will it just
>plough through all the records one by one, anyway?

It has to read each row in order to evaluate the expression.  An index
will do you no good.

How could it be otherwise?

>
>Niclas

Thread
WHERE clause efficiencyNiclas Hedhman4 Oct
  • Re: WHERE clause efficiencyPaul DuBois4 Oct
    • Re: WHERE clause efficiencyNiclas Hedhman4 Oct