Re: optimal selects and indexes ?

2003-03-28 Thread Keith C. Ivey
On 28 Mar 2003 at 10:08, Steve Phillips wrote: > SELECT sum(bytes) FROM tb_ipdata_0303 WHERE (source_ip > 3329275903 AND > source_ip < 3329276160) OR (dest_ip > 3329275903 AND dest_ip < 3329276160) > AND (time > 1048802400 AND time < 1048805999); Using "OR" like that prevents indexes from bei

RE: optimal selects and indexes ?

2003-03-28 Thread Dathan Vance Pattishall
When ever you use an index on multiple columns remember that mysql uses the concept of leftmost prefix. I'll explain with an example from one of your key make-ups below If you have dest_ip and source_ip in your select statement idx_time_dest_ip_source_ip would not work, because time is your leftm

Re: optimal selects and indexes ?

2003-03-28 Thread Paul DuBois
At 10:08 -1100 3/28/03, Steve Phillips wrote: Hey there, I have a database where i am collecting netflow records, the number of entries in a table after a day or so reaching toward the millions of rows I am trying to pull hourly reports, summarizing the byte count's for the hour previous and w