Re: [PATCH] Keeps tracking the uniqueness with UniqueKey

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>, "Hou, Zhijie" <houzj(dot)fnst(at)cn(dot)fujitsu(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Floris Van Nee <florisvannee(at)optiver(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, "rushabh(dot)lathia(at)gmail(dot)com" <rushabh(dot)lathia(at)gmail(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Subject: Re: [PATCH] Keeps tracking the uniqueness with UniqueKey
Date: 2020-11-30 10:04:34
Message-ID: 0e4ecefb-17b2-fbe1-7c3e-e7d68a744b9b@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26/11/2020 16:58, Andy Fan wrote:
> This patch has stopped moving for a while,  any suggestion about
> how to move on is appreciated.

The question on whether UniqueKey.exprs should be a list of
EquivalenceClasses or PathKeys is unresolved. I don't have an opinion on
that, but I'd suggest that you pick one or the other and just go with
it. If it turns out to be a bad choice, then we'll change it.

Quickly looking at the patches, there's one thing I think no one's
mentioned yet, but looks really ugly to me:

> + /* Make sure the path->parent point to current joinrel, can't update it in-place. */
> + foreach(lc, outer_rel->pathlist)
> + {
> + Size sz = size_of_path(lfirst(lc));
> + Path *path = palloc(sz);
> + memcpy(path, lfirst(lc), sz);
> + path->parent = joinrel;
> + add_path(joinrel, path);
> + }

Copying a Path and modifying it like that is not good, there's got to be
a better way to do this. Perhaps wrap the original Paths in
ProjectionPaths, where the ProjectionPath's parent is the joinrel and
dummypp=true.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yulin PEI 2020-11-30 11:07:10 回复: [PATCH] BUG FIX: Core dump could happen when VACUUM FULL in standalone mode
Previous Message tsunakawa.takay@fujitsu.com 2020-11-30 09:34:57 RE: POC: postgres_fdw insert batching