Re: Display of multi-target-table Modify plan nodes in EXPLAIN

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Display of multi-target-table Modify plan nodes in EXPLAIN
Date: 2015-03-23 05:29:31
Message-ID: CAFjFpRfAg0fBVL7010keehhpi5zayqzEvwfbvPcHLm1X4Kot5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 23, 2015 at 10:51 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com> writes:
> > On Sun, Mar 22, 2015 at 6:32 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> What I'm imagining instead is that when there's more than one
> >> target relation, we produce output like ...
>
> > This looks better.
> > In the format above, you have specified both the Remote SQL for scan as
> > well as update but in the example you have only mentioned only Remote SQL
> > for update; it may be part of "... etc ...". It's better to provide both.
>
> Hm? We don't have scan nodes that read more than one table, so I'm
> not following your point.
>
> regards, tom lane
>

In the format you specified
Multi-Table Update
Relation Name: pt1 -- this is the *nominal* target
Target Relations:
[
Relation Name: pt1 -- first actual target
Schema: public
Alias: pt1
]
[
Relation Name: ft1
Schema: public
Alias: ft1
Remote SQL: UPDATE ref1 ...
]

Plans:
Plan: (seq scan on pt1 here)
Plan: (foreign scan on ft1 here)
For relation ft1, there is an Update node as well as a scan node. Update
node has Update Remote SQL and Scan will have corresponding SELECT Remote
SQL.

But in the text output you gave
Update on public.pt1 (cost=0.00..321.05 rows=3541 width=46)
Update on public.pt1
Foreign Update on public.ft1
Remote SQL: UPDATE public.ref1 SET c1 = $2 WHERE ctid = $1
Foreign Update on public.ft2
Remote SQL: UPDATE public.ref2 SET c1 = $2 WHERE ctid = $1
Update on public.child3
-> Seq Scan on public.pt1 (cost=0.00..0.00 rows=1 width=46)
Output: (pt1.c1 + 1), pt1.c2, pt1.c3, pt1.ctid
... etc ...

For ft1 there is only Update Remote SQL. whereas for child3 you have
specified the Seq Scan as well. I was wondering if the foreign scan on ft1
is part of "...etc..."?. Further we have to make it clear which scan goes
with which Update, either by listing the scans in the same order as updates
or by associating each scan with corresponding update.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2015-03-23 05:31:46 Re: Auditing extension for PostgreSQL (Take 2)
Previous Message Michael Paquier 2015-03-23 05:23:36 Re: Table-level log_autovacuum_min_duration