Re: SELECT statement returns in 10seconds, but INSERT/CREATE TABLE ASwith same SELECT takes 7 minutes - Mailing list pgsql-performance

From Vladimir Ryabtsev
Subject Re: SELECT statement returns in 10seconds, but INSERT/CREATE TABLE ASwith same SELECT takes 7 minutes
Date
Msg-id CAMqTPqkMHOBzNBqxsOQenEjBCs4vA7pevt0BLZc3CX9hY8ypUg@mail.gmail.com
Whole thread Raw
In response to Re: SELECT statement returns in 10seconds, but INSERT/CREATE TABLE AS with same SELECT takes 7 minutes  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: SELECT statement returns in 10seconds, but INSERT/CREATE TABLEAS with same SELECT takes 7 minutes  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-performance
> It did --- see the Gather node.
But "workers launched: 1"...
To my opinion, such a dramatic difference cannot be explained with avoiding parallelism, the query was just stuck in a very inefficient plan (even though almost all source data is read from cache).

Additionally, I think author can try CREATE STATISTICS on the bunch of columns used in join. Very low rows estimate for this join may come from multiplying selectivities for each column assuming they are independent.

Vlad

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: SELECT statement returns in 10seconds, but INSERT/CREATE TABLE AS with same SELECT takes 7 minutes
Next
From: Justin Pryzby
Date:
Subject: Re: SELECT statement returns in 10seconds, but INSERT/CREATE TABLEAS with same SELECT takes 7 minutes