Re: *very* slow query to summarize data for a month ... - Mailing list pgsql-performance

From Dennis Bjorklund
Subject Re: *very* slow query to summarize data for a month ...
Date
Msg-id Pine.LNX.4.44.0311110747090.26313-100000@zigo.dhs.org
Whole thread Raw
In response to *very* slow query to summarize data for a month ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
Responses Re: *very* slow query to summarize data for a month ...
Re: *very* slow query to summarize data for a month ...
List pgsql-performance
On Mon, 10 Nov 2003, Marc G. Fournier wrote:

>
> explain analyze SELECT ts.company_id, company_name, SUM(ts.bytes) AS total_traffic
>     FROM company c, traffic_logs ts
>    WHERE c.company_id = ts.company_id
>      AND month_trunc(ts.runtime) = '2003-10-01'
> GROUP BY company_name,ts.company_id;

What if you do

  ts.runtime >= '2003-10-01' AND ts.runtime < '2003-11-01'

and add an index like (runtime, company_name, company_id)?


--
/Dennis


pgsql-performance by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: *very* slow query to summarize data for a month ...
Next
From: Rajesh Kumar Mallah
Date:
Subject: Suggestions for benchmarking 7.4RC2 against 7.3