pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Voytsekhovskyy <young.inbox@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Query plan: SELECT vs INSERT from same select
Date: Tue, 23 Jul 2019 18:01:25 -0400
Message-ID: <31702.1563919285@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPa4P2bmeFJx-Jip6XP1YyJG1ddWBv5nNrzN4ffXtEkG8Eki6w@mail.gmail.com>
References: <CAPa4P2bv4KaoQvrn56FzWPEbnp6-oVO15VT7_GUJ5hnUNt0Beg@mail.gmail.com>
	<29965.1563916690@sss.pgh.pa.us>
	<CAPa4P2bmeFJx-Jip6XP1YyJG1ddWBv5nNrzN4ffXtEkG8Eki6w@mail.gmail.com>

[ please keep the list cc'd ]

Alexander Voytsekhovskyy <young.inbox@gmail.com> writes:
> Sorry again
> here is both links:
> https://explain.depesz.com/s/AEWj
> https://explain.depesz.com/s/CHwF

Don't think I believe that those are the same query --- there's a
CTE in the second one that doesn't appear in the first, and it is
eating a lot of time too.

I have a vague recollection that there are cases where optimizations
are possible in plain SELECT but not in data-modifying queries.
So maybe this isn't pilot error but something triggered by that.
We'd need to see a self-contained test case to verify that though.

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <31702.1563919285@sss.pgh.pa.us>
Permalink:  ../31702.1563919285@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31702.1563919285@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, young.inbox@gmail.com
  Subject: Re: Query plan: SELECT vs INSERT from same select
  In-Reply-To: <31702.1563919285@sss.pgh.pa.us>
  References: <CAPa4P2bv4KaoQvrn56FzWPEbnp6-oVO15VT7_GUJ5hnUNt0Beg@mail.gmail.com> <29965.1563916690@sss.pgh.pa.us> <CAPa4P2bmeFJx-Jip6XP1YyJG1ddWBv5nNrzN4ffXtEkG8Eki6w@mail.gmail.com> <31702.1563919285@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