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

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Jay Levitt <jay(dot)levitt(at)gmail(dot)com>, 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-06-15 10:55:41
Message-ID: 4.3.2-J.20120615194845.03a6fa20@129.60.53.11
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I would like to ask a question before looking into the patch.

At 21:56 12/03/30 -0400, Jay Levitt wrote:
>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?

ISTM that in many cases, the result size of a set-returning function is
not so large compared with that of a full plain table scan. So, in such a
case a full hash aggregation is not so time consuming. Am I wrong?

Best regards,
Etsuro Fujita

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Honza Horak 2012-06-15 12:10:21 Re: Ability to listen on two unix sockets
Previous Message Florian Pflug 2012-06-15 10:48:24 Re: libpq compression