From: | Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> |
---|---|
To: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavan Deolasee <pavan(dot)deolasee(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Another way to fix inherited UPDATE/DELETE |
Date: | 2019-02-20 05:11:11 |
Message-ID: | CABOikdNEcvnxYcieBZ0aK-KHZ=omwan600kYQKrh+Cbi4xj6fQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Feb 20, 2019 at 4:23 AM David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
wrote:
> On Wed, 20 Feb 2019 at 10:49, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > What if we dropped that idea, and instead defined the plan tree as
> > returning only the columns that are updated by SET, plus the row
> > identity? It would then be the ModifyTable node's job to fetch the
> > original tuple using the row identity (which it must do anyway) and
> > form the new tuple by combining the updated columns from the plan
> > output with the non-updated columns from the original tuple.
> >
> > DELETE would be even simpler, since it only needs the row identity
> > and nothing else.
>
> While I didn't look at the patch in great detail, I think this is how
> Pavan must have made MERGE work for partitioned targets. I recall
> seeing the tableoid being added to the target list and a lookup of the
> ResultRelInfo by tableoid.
>
> Maybe Pavan can provide more useful details than I can.
>
Yes, that's the approach I took in MERGE, primarily because of the hurdles
I faced in handling partitioned tables, which take entirely different route
for UPDATE/DELETE vs INSERT and in MERGE we had to do all three together.
But the approach also showed significant performance improvements.
UPDATE/DELETE via MERGE is far quicker as compared to regular UPDATE/DELETE
when there are non-trivial number of partitions. That's also a reason why I
recommended doing the same for regular UPDATE/DELETE, but that got lost in
the MERGE discussions. So +1 for the approach.
We will need to consider how this affects EvalPlanQual which currently
doesn't have to do anything special for partitioned tables. I solved that
via tracking the expanded-at-the-bottom child in a separate
mergeTargetRelation, but that approach has been criticised. May be Tom's
idea doesn't have the same problem or most likely he will have a far better
approach to address that.
Thanks,
Pavan
--
Pavan Deolasee http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-02-20 05:21:53 | Re: Another way to fix inherited UPDATE/DELETE |
Previous Message | Tom Lane | 2019-02-20 04:54:22 | Re: Another way to fix inherited UPDATE/DELETE |