0

I am using "PostgreSQL 11.4, compiled by Visual C++ build 1914, 64-bit"

I want to run parallel query for testing purpose, below is my pg_settings parameter values:

"checkpoint_completion_target"    >> "0.5"  
"default_statistics_target"       >> "100"  
"effective_cache_size"            >> "524288" "8kB"
"maintenance_work_mem"            >> "65536" "kB"
"max_connections"                 >> "100"  
"max_parallel_workers"            >> "8"    
"max_parallel_workers_per_gather" >> "2"    
"max_wal_size"                    >> "1024" "MB"
"max_worker_processes"            >> "8"    
"min_wal_size"                    >> "80" "MB"
"random_page_cost"                >> "4"    
"shared_buffers"                  >> "16384" "8kB"
"wal_buffers"                     >> "512" "8kB"
"work_mem"                        >> "4096" "kB"

While I try to explain the query it doesn't show any 'Workers Planned' how to confirm if my DB support parallel query or not?

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

EXPLAIN select /*+ PARALLEL(test_table 2) */ * from test_table where col_6 = 'Submitted'
--------------------------------------------------------------------
"Seq Scan on test_table  (cost=0.00..3858.50 rows=2633 width=928)"
"  Filter: (col_6 = 'Submitted'::text)"

====================================================================

If i enable force_parallel_mode then it shows 'Workers Planned' but always value with 1. what is the wrong with my setting or DB to run parallel query?

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

set force_parallel_mode = on;
--------------------------------------------------------------------
EXPLAIN select /*+ PARALLEL(test_table 2) */ * from test_table where col_6 = 'Submitted'
--------------------------------------------------------------------
"Gather  (cost=1000.00..5121.80 rows=2633 width=928)"
"  Workers Planned: 1"
"  Single Copy: true"
"  ->  Seq Scan on test_table  (cost=0.00..3858.50 rows=2633 width=928)"
"        Filter: (col_6 = 'Submitted'::text)"

====================================================================

3
  • A table with only 2633 rows is probably considered too small for parallel query - check min_parallel_table_scan_size Also: /*+ PARALLEL(test_table 2) */ does nothing in Postgres Commented Jul 3, 2019 at 13:47
  • min_parallel_table_scan_size >> "8MB" total table row size is : select count(*) from test_table >> "79240" and 2633 rows is for filtered record. SELECT pg_size_pretty( pg_total_relation_size('test_table') ); >> "22MB" Commented Jul 4, 2019 at 10:07
  • See Laurenz's answer about the formula that is applied when choosing how many workers to use. In your case the result of that formula is 1. Commented Jul 4, 2019 at 10:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.