Re: Air-traffic benchmark - Mailing list pgsql-performance

From hubert depesz lubaczewski
Subject Re: Air-traffic benchmark
Date
Msg-id 20100107233933.GA19526@depesz.com
Whole thread Raw
In response to Air-traffic benchmark  (Lefteris <lsidir@gmail.com>)
Responses Re: Air-traffic benchmark
List pgsql-performance
On Thu, Jan 07, 2010 at 01:38:41PM +0100, Lefteris wrote:
> airtraffic=# EXPLAIN ANALYZE SELECT "DayOfWeek", count(*) AS c FROM
> ontime WHERE "Year" BETWEEN 2000 AND 2008 GROUP BY "DayOfWeek" ORDER
> BY c DESC;

Well, this query basically has to be slow. Correct approach to this
problem is to add precalculated aggregates - either with triggers or
with some cronjob.
Afterwards query speed depends only on how good are your aggregates,
and/or how detailed.
Of course calculating them is not free, but is done on write (or
periodically), and not on user-request, which makes user-requests *much*
faster.

depesz

--
Linkedin: http://www.linkedin.com/in/depesz  /  blog: http://www.depesz.com/
jid/gtalk: depesz@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

pgsql-performance by date:

Previous
From: Lefteris
Date:
Subject: Re: Air-traffic benchmark
Next
From: "Kevin Grittner"
Date:
Subject: Re: Massive table (500M rows) update nightmare