Re: Help optimizing this query?

2007-01-08 Thread joce
Hi, I would use a (source,stamp) index, and not a (stamp,source) index to solve the performance problem. Jocelyn Fournier www.mesdiscussions.net > Brian, can you post the output of EXPLAIN for your query? > I.e., > EXPLAIN ; > > > At first glance, your query should be able to use the 'stamp

Re: Help optimizing this query?

2007-01-08 Thread Dan Buettner
Brian, can you post the output of EXPLAIN for your query? I.e., EXPLAIN ; At first glance, your query should be able to use the 'stamp-source' index since stamp is the first column indexed. However, I wonder if wrapping the "NOW() - INTERVAL 14 DAY inside a "DATE()" would help. MySQL may be ca

RE: Help optimizing this query?

2007-01-08 Thread Michael Gargiullo
-Original Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Sunday, January 07, 2007 1:12 PM To: mysql Subject: Help optimizing this query? This is the query that's killing me in the slow query log, usually taking around 20 seconds: select count(ip) as counted,stamp from i

Re: Help optimizing this query?

2007-01-07 Thread Daniel Kasak
Brian Dunning wrote: This is the query that's killing me in the slow query log, usually taking around 20 seconds: select count(ip) as counted,stamp from ip_addr where stamp>=NOW()-interval 14 day and source='sometext' group by stamp order by stamp desc; Here is the table: CREATE TABLE `ip_