List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:November 6 2001 9:23pm
Subject:Re: using index problems
View as plain text  
Well, if you are going to read a large fraction of the total rows, it 
imay be faster to skip the index.


Veniamin Konoplev wrote:

> Hello!
> 
> I have a big indexed table (by columns "date,...").
> If a range of date in the SELECT statement inreases,
> the index stops to work.
> 
> mysql> explain select count(*),SUM(In_byts) from ip_summary_d where date >
> '2001-10-21' and date < '2001-11-01';
>
> +--------------+-------+---------------+---------+---------+------+---------+------------+
> | table        | type  | possible_keys | key     | key_len | ref  | rows    | Extra  
>    |
>
> +--------------+-------+---------------+---------+---------+------+---------+------------+
> | ip_summary_d | range | PRIMARY       | PRIMARY |       3 | NULL | 2394968 | where
> used |
>
> +--------------+-------+---------------+---------+---------+------+---------+------------+
> 1 row in set (0.00 sec)
> 
> mysql> explain select count(*),SUM(In_byts) from ip_summary_d where date >
> '2001-10-20' and date < '2001-11-01';
>
> +--------------+------+---------------+------+---------+------+----------+------------+
> | table        | type | possible_keys | key  | key_len | ref  | rows     | Extra     
> |
>
> +--------------+------+---------------+------+---------+------+----------+------------+
> | ip_summary_d | ALL  | PRIMARY       | NULL |    NULL | NULL | 13719096 | where used
> |
>
> +--------------+------+---------------+------+---------+------+----------+------------+
> 1 row in set (0.00 sec)
> 
> 
> Help me please, what could be wrong ?!
> 
> 

Thread
using index problemsVeniamin Konoplev6 Nov
  • Re: using index problemsGerald Clark6 Nov