Greenplum 分发密钥依赖于其他密钥的分发

Greenplum distribution key that depends on the distribution of other key

有一个tableA按x列分布;

CREATE table A (x integer, y integer) distributed by (x);

还有另一个 table B 有列 "y" 但没有 "x".

CREATE TABLE B (y integer);

有什么方法可以根据 "y" 在 table A 上的分布来分布 B 吗?所以我们可以使用列 "y" 连接两个 tables 而无需在段之间重新分配数据?基本上意味着 table A 上的列 "y" 的分布驱动 table B.

的分布
SELECT 
*
FROM A 
JOIN B using (y);

问题是 table A 经常与 "x" 分发的其他 table 连接,这就是为什么我们不想更改 table A 的分发.

第 "y" 列是唯一的

谢谢。

不,你不能,但我不会那么担心。你把这两个table连在一起的时候过滤的是tableb还是a?如果是这样,Greenplum 将使用它来仅移动完成数据所需的数据。

其次,如果您担心它,您可以通过添加来自 table b.

的列来反规范化 table a