我正在使用“PostgreSQL 11.4,由 Visual C++ build 1914 编译,64 位”
我想为测试目的运行并行查询,下面是我的 pg_settings 参数值:
"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"
当我尝试解释查询时,它没有显示任何“工人计划”如何确认我的数据库是否支持并行查询?
++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++
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)"
==================================================== ===================
如果我启用 force_parallel_mode 然后它显示“工人计划”但总是值为 1。我的设置或数据库有什么问题来运行并行查询?
++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++
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)"
==================================================== ===================