我们开发了一个基于 postgres_fdw 的 fdw,它在保持数据压缩的大存储库(大数据)中实现搜索。我们正在尝试使用 postgres 分区表的概念,以便我们可以同时在多个分区上并行搜索。对于外部数据包装器,我们需要“并行追加”。
有人知道这是否会在 Postgres 11 中得到解决?
如果我的查询导致在本地分区搜索,postgres 使用并行性,但如果它导致外部扫描,则不会。
本地分区:
explain select * from precio where fecha >= '2017-01-20' and fecha <= '2017-01-21' and plusalesprice < 1
Gather (cost=1000.00..969527.35 rows=81568 width=60)
Workers Planned: 2
-> Parallel Append (cost=0.00..960370.55 rows=33986 width=60)
-> Parallel Seq Scan on precio_20170121 (cost=0.00..589086.00 rows=19293 width=60)
Filter: ((fecha >= '2017-01-20'::date) AND (fecha <= '2017-01-21'::date) AND (plusalesprice < '1'::numeric))
-> Parallel Seq Scan on precio_20170120 (cost=0.00..371114.62 rows=14693 width=60)
Filter: ((fecha >= '2017-01-20'::date) AND (fecha <= '2017-01-21'::date) AND (plusalesprice < '1'::numeric))
国外分区:
explain select * from precio where fecha >= '2017-01-01' and fecha <= '2017-01-02' and plusalesprice < 1
Append (cost=200.00..2650400.00 rows=20000000 width=60)
-> Foreign Scan on precio_xdr20170101 (cost=200.00..1275200.00 rows=10000000 width=60)
Filter: ((fecha >= '2017-01-01'::date) AND (fecha <= '2017-01-02'::date) AND (plusalesprice < '1'::numeric))
-> Foreign Scan on precio_xdr20170102 (cost=200.00..1275200.00 rows=10000000 width=60)
Filter: ((fecha >= '2017-01-01'::date) AND (fecha <= '2017-01-02'::date) AND (plusalesprice < '1'::numeric))