Re: GROUP BY on a large table -- an idea

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Dawid Kuroczko <qnex42(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GROUP BY on a large table -- an idea
Date: 2006-10-12 09:57:26
Message-ID: 20061012095726.GC11723@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 12, 2006 at 09:52:11AM +0200, Dawid Kuroczko wrote:
> Recently I've been playing with quite a big table (over 50mln rows),
> and did some SELECT ... sum(...) WHERE ... GROUP BY ... queries.
>
> The usual plan for these is to sort the entries according to GROUP BY
> specification, then to run aggregates one by one. If the data to be
> sorted is large enough, PostgreSQL has no other option than to spill
> to disk, which well, Isn't the fastest...

<snip>

Sounds an awful lot like the HashAggregate nodetype which has existed
since at least 7.4. It has a hashtable of "keys" with attached
"states".

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2006-10-12 10:30:30 Re: Patch for Win32 blocking problem
Previous Message Simon Riggs 2006-10-12 09:35:47 Re: Hints WAS: Index Tuning Features