List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 18 1999 12:11pm
Subject:Re: select doesn't seem to be using index
View as plain text  
On Sat, 1999-09-18 04:23:31 +0200, Benjamin Pflugmann wrote:
> [...] MySQL is not able to use indexes on expressions, i.e.
> LEFT(AlphaOrder,1) will not use an index (the same is valid for i+0
> and similar stuff).
> 
> There is an own section in the manual when MySQL will take advantage
> of indexes. You can rewrite your condition to
> 
> AlphaOrder >= 'C' AND AlphaOrder < 'D'
> 
> In this form, AlphaOrder is used directly with <,>,= and therefore
> indexes are used.

Just as a mini side note:
  AlphaOrder LIKE 'c%'
will also use an index on AlphaOrder.

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
select doesn't seem to be using indexa rancid amoeba18 Sep
  • Re: select doesn't seem to be using indexPaul DuBois18 Sep
  • Re: select doesn't seem to be using indexBenjamin Pflugmann18 Sep
    • Re: select doesn't seem to be using indexMartin Ramsch18 Sep
    • Re: select doesn't seem to be using indexa rancid amoeba18 Sep
      • Re: select doesn't seem to be using indexBenjamin Pflugmann19 Sep
        • Re: select doesn't seem to be using indexa rancid amoeba19 Sep
          • Re: select doesn't seem to be using indexMichael Widenius20 Sep
        • similar question plus ORDER BY (was Re: select doesn't seem to be using index)AAron nAAs20 Sep
      • Re: select doesn't seem to be using indexMichael Widenius19 Sep