分段之间的Greenplum数据分布

时间:2011-10-13 02:18:45

标签: distribution segments greenplum

我有一个Greenplum数据库,其中有10个段反映了10个硬盘。我的表分为基于日期的主分区和基于哈希id的辅助分区。因此,一个月将有30个主分区,每个分区包含100个子分区。并且基于hashid加载子分区中的数据。现在的问题是这些分区是如何在段之间分配的。

猜猜1:

seg1(equally distributed based on pri partition : 30datepartition/10=3 date partitions)
date1---0-99 sub partition of hashid
date2---0-99 sub partition of hashid
date3---0-99 sub partition of hashid

seg2(equally contains 30/10=3 date partitions)
date4---0-99 partition of hashid
date5---0-99 partition of hashid
date6---0-99 partition of hashid

...
..

seg10
date27---0-99 partition of hashid
date28---0-99 partition of hashid
date29---0-99 partition of hashid

OR

猜猜2

seg1(distributed by 100hashid/10=10 hashid partitions)
date1---0-9 partition of hashid
date2---0-9 partition of hashid
...
date30---0-9 partition of hashid

seg2(equally contains 100hashid/10=10 hashid partitions)
date1---10-19 partition of hashid
date2---10-19 partition of hashid
...
date30---10-19 partition of hashid

这是如何工作的?猜猜1或2,如果两者都错了,请点亮我在分段级别上分发的方式。

基于哈希id对它进行子分区是一个好的设计吗?由于我每天处理600万条记录,并且我必须存储一年的日期,我希望搜索能够获得非常少的数据。换句话说,基于密钥查询,我将确定和hashid范围,它将搜索那些特定的分区。

由于 Ganesh.R

3 个答案:

答案 0 :(得分:2)

在Greenplum中,分发键确定数据如何分散在群集中的所有段中。分区将每个段内的数据分解为更小的块,就像在任何其他DBMS中进行分区一样。

您希望选择一个分布式密钥,该密钥在群集中均匀地划分数据,然后使用分区来细分该表。我们的想法是设置表,以便集群中的每个段DB都可以处理大小相同的数据集。总体数据库响应将与群集中最慢的段一样慢。

答案 1 :(得分:0)

我不是100%肯定,但我认为每个节点分割分区。因此,在您的示例中,每个节点将有30个分区。

如果要指定要剪切的键,请使用DISTRIBUTE BY

答案 2 :(得分:0)

创建表时,分配键是任何键,例如event_id,并且基于任何日期列(例如event_date)完成分发, 最好的方法是按列分区应该是分配键的一部分,以正确分配数据/用于偏斜,

由于