pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Amarendra Konda <amar.vijaya@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-performance@lists.postgresql.org, pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query )
Date: Thu, 07 May 2020 17:26:08 -0400
Message-ID: <32488.1588886768@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYp4HEVoMWZY6YHPTESP-8yZdyKkXU5tUoefGgxxb2zXw@mail.gmail.com>
References: <CAJNAD0=duUPoM56Vgh5pZWOcsvUgCcOd0d+XSbm+06i6xE_oJg@mail.gmail.com>
	<92fe033c-0221-30e3-1143-de8b0c8d923b@aklaver.com>
	<CAKFQuwa0BdDqPeM+emDDo1XCa+R9RcVinHW6cECPuuWaO4GeZw@mail.gmail.com>
	<CAJNAD0kLL8WvRcJy+GP5wjTh3Ji4AkJYN5jWa0Ous1WAzhcZkA@mail.gmail.com>
	<CAKFQuwYp4HEVoMWZY6YHPTESP-8yZdyKkXU5tUoefGgxxb2zXw@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thu, May 7, 2020 at 10:49 AM Amarendra Konda <amar.vijaya@gmail.com>
> wrote:
>> Can you please explain, why it is getting more columns in output, even
>> though we have asked for only one column ?
>> * Output: pa.process_activity_id, pa.process_activity_type, pa.voice_url,
>> pa.process_activity_user_id, pa.app_id, pa.process_instance_id, pa.alias,
>> pa.read_by_user, pa.source, pa.label_category_id, pa.label_id,
>> pa.csat_response_id, m.process_activity_fragments, pa.created, pa.updated,
>> pa.rule_id, pa.marketing_reply_id, pa.delivered_at, pa.reply_fragments,
>> pa.status_fragment, pa.internal_meta, pa.interaction_id,
>> pa.do_not_translate, pa.should_translate, pa.in_reply_to*

> Not knowing the source code in this area at all...

> I'm pretty sure its because it doesn't matter.

It's actually intentional, to save a projection step within that plan
node.  We'll discard the extra columns once it matters, at some higher
plan level.

(There have been some debates on -hackers about whether this optimization
is still worth anything, given all the executor improvements that have
been made since it went in.  But it was clearly a win at the time.)

			regards, tom lane





view thread (13+ messages)  latest in thread

Message-ID: <32488.1588886768@sss.pgh.pa.us>
Permalink:  ../32488.1588886768@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/32488.1588886768@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, amar.vijaya@gmail.com, adrian.klaver@aklaver.com, pgsql-general@postgresql.org
  Subject: Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query )
  In-Reply-To: <32488.1588886768@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