Re: Maintain the pathkesy for subquery from outer side information - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Maintain the pathkesy for subquery from outer side information
Date
Msg-id CAKU4AWo6-=9mg3UQ5UJhGCMw6wyTPyPGgV5oh6dFvwEN=+hb_w@mail.gmail.com
Whole thread Raw
In response to Re: Maintain the pathkesy for subquery from outer side information  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> I think that in cases where there's not a semantic hazard involved,
> we'd usually have pulled up the subquery so that this is all moot
> anyway.
>

I get your point with this statement. Things driven by this idea look
practical and lucky.  But for the UniqueKey stuff, we are not
that lucky.

SELECT pk FROM t;  -- Maintain the UniqueKey would be not necessary.

However

SELECT DISTINCT pk FROM (SELECT volatile_f(a), pk from t) WHERE ..;

Maintaining the UniqueKey in subquery is necessary since it is useful outside.

-- 
Best Regards
Andy Fan (https://www.aliyun.com/)



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: pg14b1 stuck in lazy_scan_prune/heap_page_prune of pg_statistic
Next
From: Andrey Borodin
Date:
Subject: Re: Avoiding data loss with synchronous replication