Re: PoC: Grouped base relation

From: Pantelis Theodosiou <ypercube(at)gmail(dot)com>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PoC: Grouped base relation
Date: 2017-01-10 18:55:22
Message-ID: CAE3TBxxTrxH++SAXcP6to0+zwLWpSh3Qxad0s3w-8Boeump39A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 10, 2017 at 6:52 PM, Pantelis Theodosiou <ypercube(at)gmail(dot)com>
wrote:

>
>
> On Mon, Jan 9, 2017 at 5:56 PM, Antonin Houska <ah(at)cybertec(dot)at> wrote:
>
>> Attached is a draft patch that lets partial aggregation happen at base
>> relation level. If the relations contain relatively small number of
>> groups,
>> the number of input rows of the aggregation at the query level can be
>> reduced
>> this way. Also, if append relation and postgres_fdw planning is enhanced
>> accordingly, patch like this can let us aggregate individual tables on
>> remote
>> servers (e.g. shard nodes) and thus reduce the amount of rows subject to
>> the
>> final aggregation.
>>
>> For example, consider query
>>
>> SELECT b.j, sum(a.x) FROM a, b WHERE a.i = b.j GROUP BY b.j;
>>
>> and tables "a"
>>
>> i | x
>> -------
>> 1 | 3
>> 1 | 4
>>
>> and "b"
>>
>> j
>> ---
>> 1
>> 1
>>
>
> The example should have j= 1,2 , right?
>
> and "b"
>
> j
> ---
> 1
> 2
>
>
>
>> The base relations grouped look like
>>
>> i | sum(a.x)| count(*)
>> -----------------------
>> 1 | 7 | 2
>>
>
>
> Otherwise, the sum and count would be 14 and 4.
>
>
>>
>> and
>>
>> j | count(*)
>> -------------
>> 1 | 2
>>
>>
>>
>>
>
> Pantelis
>

Or perhaps I should be reading more carefully the whole mail before
posting. Ignore the previous.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-01-10 19:03:59 Re: Replication/backup defaults
Previous Message Pantelis Theodosiou 2017-01-10 18:52:15 Re: PoC: Grouped base relation