List:General Discussion« Previous MessageNext Message »
From:Egor Egorov Date:September 6 2004 10:02am
Subject:Re: please explain why this query isn't optimized
View as plain text  
Dave Dyer <ddyer@stripped> wrote:

> Before I post it as a bug, perhaps someone can explain why
> this query is not optimized to use the index (it has to examine all 287k rows).
> 
> mysql> explain SELECT MAX(changed) FROM archived_stats where changed>0;
> | table          | type  | possible_keys | key     | key_len | ref  | rows    | Extra
>                    |
> | archived_stats | range | changed       | changed |       4 | NULL | 2878820 | Using
> where; Using index |

There are 2.878k rows, not 287k. 

And it's optimized as much as possible, the key is used. 





-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   Egor.Egorov@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com



Thread
please explain why this query isn't optimizedDave Dyer4 Sep
  • RE: please explain why this query isn't optimizedDonny Simonton4 Sep
    • Re: please explain why this query isn't optimizedEric Bergen4 Sep
    • RE: please explain why this query isn't optimizedDave Dyer4 Sep
      • Re: please explain why this query isn't optimizedDan Nelson4 Sep
        • Re: please explain why this query isn't optimizedDave Dyer4 Sep
          • RE: please explain why this query isn't optimizedDonny Simonton4 Sep
  • Re: please explain why this query isn't optimizedEgor Egorov6 Sep
Re: please explain why this query isn't optimizedBill Easton6 Sep
  • Re: please explain why this query isn't optimizedDavid T-G7 Sep
    • Re: please explain why this query isn't optimizedEgor Egorov7 Sep
  • Re: please explain why this query isn't optimizedEgor Egorov7 Sep