Re: Query plan: SELECT vs INSERT from same select - Mailing list pgsql-general

From Tom Lane
Subject Re: Query plan: SELECT vs INSERT from same select
Date
Msg-id 29965.1563916690@sss.pgh.pa.us
Whole thread Raw
In response to Query plan: SELECT vs INSERT from same select  (Alexander Voytsekhovskyy <young.inbox@gmail.com>)
List pgsql-general
Alexander Voytsekhovskyy <young.inbox@gmail.com> writes:
> You can see explain analyze verbose here:
> https://explain.depesz.com/s/AEWj

> The problem is, when i wrap it to

> A)
> INSERT INTO norepl_1542_result (axis_x1, axis_y1, v_1)
> SELECT .... SAME QUERY

> OR even

> B)
> WITH rows AS (
> ... SAME SELECT QUERY ...
> )
> INSERT INTO norepl_1542_result (axis_x1, axis_y1, v_1)
> SELECT * FROM rows

> The query time dramatically drops to 500+ seconds.

> You can see explain analyze verbose here
> https://explain.depesz.com/s/AEWj

That's the same link.

> As you can see, 100% of time goes to same SELECT query, there is no issues
> with INSERT-part

We can't see any such thing from what you posted.

            regards, tom lane



pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: Re: Query plan: SELECT vs INSERT from same select
Next
From: Tom Lane
Date:
Subject: Re: Query plan: SELECT vs INSERT from same select