Re: Query plan: SELECT vs INSERT from same select

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Voytsekhovskyy <young(dot)inbox(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Query plan: SELECT vs INSERT from same select
Date: 2019-07-23 22:01:25
Message-ID: 31702.1563919285@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

[ please keep the list cc'd ]

Alexander Voytsekhovskyy <young(dot)inbox(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sergey Koposov 2019-07-23 22:19:27 pg_dump schema in pg11 without global permissions
Previous Message Tom Lane 2019-07-23 21:18:10 Re: Query plan: SELECT vs INSERT from same select