在PostgreSQL中需要对外部表进行并行追加
我们开发了一个基于postgres_fdw的fdw,该fdw在大存储库(大数据)中实现搜索,从而保持数据的压缩。我们正尝试使用postgres分区表的概念,这样我们就可以同时在多个分区上并行搜索。我们需要为外部数据包装器“并行附加” 有人知道这件事会不会在第11期研究生考试中讨论吗 如果我的查询导致在本地分区进行搜索,postgres将使用并行性,但如果它导致外部扫描,则不会 地方党派:在PostgreSQL中需要对外部表进行并行追加,postgresql,postgres-fdw,postgresql-11,Postgresql,Postgres Fdw,Postgresql 11,我们开发了一个基于postgres_fdw的fdw,该fdw在大存储库(大数据)中实现搜索,从而保持数据的压缩。我们正尝试使用postgres分区表的概念,这样我们就可以同时在多个分区上并行搜索。我们需要为外部数据包装器“并行附加” 有人知道这件事会不会在第11期研究生考试中讨论吗 如果我的查询导致在本地分区进行搜索,postgres将使用并行性,但如果它导致外部扫描,则不会 地方党派: explain select * from precio where fecha >= '2017-0
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,其中fecha>='2017-01-20'和fecha并行追加(成本=0.00..960370.55行=33986宽度=60)
->precio_20170121上的平行顺序扫描(成本=0.00..589086.00行=19293宽度=60)
过滤器:((fecha>='2017-01-20'::日期)和(precio_20170120上的fecha并行序列扫描(成本=0.00..371114.62行=14693宽度=60)
过滤器:((fecha>='2017-01-20'::日期)和(fecha='2017-01-01'和precio_xdr20170101上的fecha外部扫描(成本=200.00..1275200.00行=10000000宽=60)
过滤器:((fecha>='2017-01-01'::日期)和(precio_xdr20170102上的fecha外部扫描(成本=200.00..1275200.00行=10000000宽度=60)
过滤器:((fecha>='2017-01-01'::date)和(fecha要能够使用并行追加
,所有儿童都需要安全地在并行工作者中运行。postgres\u fdw
还不能保证安全(即使在PostgreSQL 11之后),因此由postgres\u fdw
管理的任何子表都不能并行扫描。我能够对我的fdw执行并行附加。除此之外,我还必须序列化需要在工作人员之间共享的状态结构。很快,我将在此处发布答案,更好地解释我是如何做到的。在我的情况下,我可以确保我的远程表中的所有扫描都可以并行完成。
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))