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 writing this out to a csv file

My query currently looks something like..

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);

It appears that with a explain SELECT statement that no indexes are being used for this query. As I'm a bit of a newbie at indexing, I have currently indexed

  PRIMARY KEY  (id),
  KEY idx_source_ip (source_ip),
  KEY idx_dest_ip (dest_ip),
  KEY idx_time_source_ip (time,source_ip),
  KEY idx_time_dest_ip (time,dest_ip),
  KEY idx_time_dest_ip_source_ip (time,dest_ip,source_ip),
  KEY idx_time (time)

yet the explain still claims that no indexes are being consulted for my query, why would this be ? is there a better way to construct the select so it uses indexes ? or have i created my indexes incorrectly ?

any help would be appreciated :-)




-- Steve Phillips Professional Slacker



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to