Re: explain plan difference - Mailing list pgsql-general

From Steve Baldwin
Subject Re: explain plan difference
Date
Msg-id CAKE1AiZgvj4TbgSaaCgaUMkHUeKxQ5W9u0G3SobihG-ts0ovxg@mail.gmail.com
Whole thread Raw
In response to Re: explain plan difference  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: explain plan difference  (Ravi Krishna <srkrishna@yahoo.com>)
List pgsql-general
Thanks very much for the explanation Tom !!  You are correct - there are dropped columns in the original.

Cheers,

Steve

On Mon, Nov 4, 2019 at 3:01 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: explain plan difference
Next
From: Laurenz Albe
Date:
Subject: Re: Are my autovacuum settings too aggressive for this table?