Re: Questions regarding distinct operation implementation

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Ankit Kumar Pandey <itsankitkp(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pghackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Questions regarding distinct operation implementation
Date: 2022-12-04 16:55:06
Message-ID: edc608b5-4d42-5329-edbd-139c46fc3fe0@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/4/22 14:34, Ankit Kumar Pandey wrote:
>
> On 04/12/22 02:27, David Rowley wrote:
>>
>
>> If you were to limit this to only working with the query you mentioned
>> in [1], i.e PARTITION BY without an ORDER BY, then you only need to
>> aggregate once per partition per aggregate and you only need to do
>> that once all of the tuples for the partition are in the tuplestore.
>> It seems to me like you could add all the records to a tuplesort and
>> then sort by the DISTINCT column then aggregate everything except for
>> consecutive duplicates. You can then aggregate any other aggregates
>> which share the same DISTINCT column, otherwise, you just destroy the
>> tuplesort and rinse and repeat for the next aggregate.
>
> This looks like way to go that would ensure main use case of portability
> from Oracle.

The goal should not be portability from Oracle, but adherence to the
standard.
--
Vik Fearing

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2022-12-04 17:01:33 Re: Error-safe user functions
Previous Message Andrew Dunstan 2022-12-04 16:21:41 Re: Error-safe user functions