pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Steve Baldwin <steve.baldwin@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: explain plan difference
Date: Sun, 03 Nov 2019 23:01:19 -0500
Message-ID: <14145.1572840079@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKE1AiYdwjx_Wq07vE=uwHeDHa8cL35iD_GyqHrKfJ3WihHBkg@mail.gmail.com>
References: <CAKE1AiYdwjx_Wq07vE=uwHeDHa8cL35iD_GyqHrKfJ3WihHBkg@mail.gmail.com>

Steve Baldwin <steve.baldwin@gmail.com> writes:
> I guess the difference doesn't have a huge bearing (as far as I can tell)
> on the result, but it just seems odd that the inner-most 'Output' step
> outputs the entire row in the case of the copy and only the required field
> in the case of the original table. What triggers that behaviour?

The plan with the full output row is actually slightly cheaper, or at
least so the planner thinks, because it saves a projection step.
I imagine the reason you're not getting that with the original table
is that there are some dropped column(s) in the original table, forcing
the projection to be done to get rid of them.

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <14145.1572840079@sss.pgh.pa.us>
Permalink:  ../14145.1572840079@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14145.1572840079@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, steve.baldwin@gmail.com
  Subject: Re: explain plan difference
  In-Reply-To: <14145.1572840079@sss.pgh.pa.us>
  References: <CAKE1AiYdwjx_Wq07vE=uwHeDHa8cL35iD_GyqHrKfJ3WihHBkg@mail.gmail.com> <14145.1572840079@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox