Skip site navigation (1) Skip section navigation (2)

Re: [PATCH] Lazy hashaggregate when no aggregation is needed

From: Jay Levitt <jay(dot)levitt(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ants Aasma <ants(at)cybertec(dot)at>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Francois Deliege <fdeliege(at)gmail(dot)com>
Subject: Re: [PATCH] Lazy hashaggregate when no aggregation is needed
Date: 2012-03-31 01:56:36
Message-ID: 4F766454.9040909@gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Tom Lane wrote:
> Ants Aasma<ants(at)cybertec(dot)at> writes:
>> A user complained on pgsql-performance that SELECT col FROM table
>> GROUP BY col LIMIT 2; performs a full table scan. ISTM that it's safe
>> to return tuples from hash-aggregate as they are found when no
>> aggregate functions are in use. Attached is a first shot at that.
>
> As I commented in the other thread, the user would be a lot better off
> if he'd had an index on the column in question. I'm not sure it's worth
> complicating the hashagg logic when an indexscan + groupagg would
> address the case better.

Would this patch help in the case where "table" is actually a set-returning 
function, and thus can't have an index? (I don't yet know enough about the 
tree to know when hashaggs get used). I'm wondering if this is a useful 
exception to the "restrictions can't get pushed down through GROUP BYs" rule.

Jay

In response to

Responses

pgsql-hackers by date

Next:From: Jeff JanesDate: 2012-03-31 02:07:59
Subject: Re: tracking context switches with perf record
Previous:From: Tom LaneDate: 2012-03-30 22:35:30
Subject: Re: Speed dblink using alternate libpq tuple storage

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group