【问题标题】:Greenplum data distribution among segments细分之间的Greenplum数据分布
【发布时间】:2011-12-06 14:48:46
【问题描述】:

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

猜一猜:

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

猜猜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 万条记录,而且我必须存储一年的日期,所以我希望搜索能够找到非常少的数据部分。换句话说,我将根据键查询确定哈希值范围,并将在这些特定分区中进行搜索。

谢谢 Ganesh.R

【问题讨论】:

    标签: distribution segments greenplum


    【解决方案1】:

    在 Greenplum 中,分布键决定了数据如何分散到集群中的所有段中。分区将每个段内的数据分解成更小的块,就像任何其他 DBMS 中的分区一样。

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

    【讨论】:

      【解决方案2】:

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

      如果要指定分片的键,请使用DISTRIBUTE BY

      【讨论】:

      • 我使用的是单节点版本,所以你的意思是说每个段将包含30个日期分区和每个日期100个子分区。那么每个段总共有 3000 个分区??
      • 正确。每段 3000 个分区。
      【解决方案3】:

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

      谢谢

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-11
        • 2023-01-08
        • 1970-01-01
        • 2018-06-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多