2

I have one problem - parallelism in query processing seems to now work on my database when query is enclosed in "CREATE TABLE".

Plain SELECT is processed perfectly in parallel so is very quick. Parallelism is shown also in EXPLAIN output and I can also see background workers in "top" monitoring. So it is much better then on pg 9.5.

But when I use the same SELECT in CREATE TABLE it runs for ages and not in parallel. It is very much slower then on pg 9.5. Parallelism in this case is not shown in EXPLAIN output and there are no background workers running in OS. I tried to set "force_parallel_mode" = ON but without any change.

Is there some magical setting I missed which should be changed from standard setting to use parallelism also in CREATE TABLE? Or is this expected behavior "by design"?

UPDATE: OK, seems to be "by design" - Parallel queries on CTE for writing operations in PostgreSQL

But in that case CREATE TABLE as SELECT seems to give very bad performance on 9.6 with comparison with 9.5...

  1. UPDATE: Looks like PostgreSQL 9.6 requires higher setting of work_mem than 9.5 - I fiddled with query plans of badly running queries and found that just by changes of work_mem setting in session I can get costs from "Sort (cost=807568233.23..807568267.50 rows=13709 width=105)" for work_mem=32MB down to "Sort (cost=151127.62..151161.89 rows=13709 width=105)" for work_mem=64MB...
Community
  • 1
  • 1
JosMac
  • 2,164
  • 1
  • 17
  • 23

0 Answers0