我將我的postgresql從9.5升級到9.6,以便使用並行執行來提高我的性能。但是,我沒有成功使用它。在我的主數據庫中,幾乎所有的選擇都是這樣的: select * from foreign_table
外部表是位於oracle數據庫上的外部表。 一些表格是大10G +和1,000,000+條記錄,所以在這種情況下,並行查詢應該幫助我很多。Postgresql 9.6並行執行從外部表
,我配置的參數:
min_parallel_relation_size = 200MB
max_parallel_workers_per_gather = 2
max_worker_processes = 8
當我嘗試使用解釋分析SELECT * FROM一張大桌子,她的大小爲1.5G,並擁有500萬點的記錄我看到的唯一的外國掃描:
Foreign Scan on customer_prod (cost=10000.00..20000.00 rows=1000
width=2438) (actual time=6.337..231408.085 rows=5770616 loops
=1)
Oracle query: ......
Planning time: 2.827 ms
Execution time: 232198.137 ms
*我也試過select_ from foreign_table,其中1 = 1但結果仍然相同。
在另一方面接下來的代碼工作:
postgres=# CREATE TABLE people_mariel_test (id int PRIMARY KEY NOT NULL, age int NOT NULL);
CREATE TABLE
postgres=# INSERT INTO people_mariel_test SELECT id, (random()*100)::integer AS age FROM generate_series(1,10000000) AS id;
INSERT 0 10000000
postgres=# explain analyze select * from people_mariel_test where age=6;
QUERY PLAN
--------------------------------------------------------------------------------
------------------------------------------------
----------
Gather (cost=1000.00..123777.76 rows=50000 width=8) (actual time=0.239..771.801 rows=99409 loops=1)
Workers Planned: 1
Workers Launched: 1
-> Parallel Seq Scan on people_mariel_test (cost=0.00..117777.76 rows=29412 width=8) (actual time=0.045..748.213 rows=49704
loops=2)
Filter: (age = 6)
Rows Removed by Filter: 4950296
Planning time: 0.261 ms
Execution time: 785.924 ms
(8 rows)
任何想法,我該怎麼繼續?
添加'ora_fdw'標籤並希望得到Laurenz的關注。但我非常懷疑,postgres並行執行設置不會影響擴展 –