List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 8 2000 2:17am
Subject:Re: Using string functions on indexed columns
View as plain text  
At 5:29 PM -0800 2000-02-07, Mike Machado wrote:
>Is there a reason when I use STRCMP() that the mysql does not use it as
>an indexed column? There is
>about 1.8 million rows in this table and it takes 0.03 seconds with the
>Username = 'blah', but like 6 minuets
>with STRCMP(UserName,'blah') = 0. Here is the status output and where it
>shows what indexes the queries use.


Because you can't compute STRCMP() without actually retrieving the
values, and don't know which values will satisfy your expression without
scanning them all.  Indexes are useless when you use a column value
as an argument to a function.

-- 
Paul DuBois, paul@stripped
Thread
Using string functions on indexed columnsMike Machado8 Feb
  • Re: Using string functions on indexed columnsPaul DuBois8 Feb
  • Re: Using string functions on indexed columnsMike Machado8 Feb
    • Re: Using string functions on indexed columnsThimble Smith8 Feb
  • Re: Using string functions on indexed columnsOrlando Andico9 Feb