Re: UniqueKey on Partitioned table.

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Floris Van Nee <florisvannee(at)optiver(dot)com>, "Hou, Zhijie" <houzj(dot)fnst(at)cn(dot)fujitsu(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>
Subject: Re: UniqueKey on Partitioned table.
Date: 2021-04-06 10:31:02
Message-ID: CAKU4AWqVcbkH5EnzPT=9hN_xkYZKiRvE2F9Er_qu3ihHoWY7ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 31, 2021 at 9:12 PM Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
wrote:

> > b). How to present the element
> > in UniqueKey. Prue EquivalenceClasses or Mix of Expr and
> EquivalenceClass as
> > we just talked about.
> I think the reason we add ECs for sort expressions is to use
> transitive relationship. The EC may start with a single member but
> later in the planning that member might find partners which are all
> equivalent. Result ordered by one is also ordered by the other. The
> same logic applies to UniqueKey as well, isn't it. In a result if a
> set of columns makes a row unique, the set of columns represented by
> the other EC member should be unique. Though a key will start as a
> singleton it might EC partners later and thus thus unique key will
> transition to all the members. With that logic UniqueKey should use
> just ECs instead of bare expressions.
>

TBH, I haven't thought about this too hard, but I think when we build the
UniqueKey, all the ECs have been built already. So can you think out an
case we start with an EC with a single member at the beginning and
have more members later for UniqueKey cases?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2021-04-06 10:55:36 Re: UniqueKey on Partitioned table.
Previous Message Etsuro Fujita 2021-04-06 10:25:16 Re: Asynchronous Append on postgres_fdw nodes.