From: | Vik Fearing <vik(at)postgresfriends(dot)org> |
---|---|
To: | Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Subject: | Re: Proposal: QUALIFY clause |
Date: | 2025-07-25 14:50:12 |
Message-ID: | b4ed9908-f000-4a5d-aae8-625607f80757@postgresfriends.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 25/07/2025 14:55, Matheus Alcantara wrote:
> On Mon Jul 21, 2025 at 7:11 PM -03, Vik Fearing wrote:
>> SELECT a, b, c
>> FROM tab
>> QUALIFY wf() OVER () = ?
>>
>>
>> can be rewritten as:
>>
>>
>> SELECT a, b, c
>> FROM (
>> SELECT a, b, c, wf() OVER () = ? AS qc
>> FROM tab
>> ) AS q
>> WHERE qc
>>
>>
>> and then let the optimizer take over. The standard does this kind of
>> thing all over the place; I don't know what the postgres project's
>> position on doing things like this are.
> With this transformation users will see a Subquery plan node even if
> it's not present on the original query, is that expected or it can be
> confusing to users?
This is a definition technique, it does not need to be implemented as a
subquery.
--
Vik Fearing
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-07-25 15:02:28 | Re: HASH_FIXED_SIZE flag gets lost when attaching to existing hash table |
Previous Message | Fabrízio de Royes Mello | 2025-07-25 14:47:52 | Use PqMsg_* macros in basebackup_copy.c |