RedShift创建列出的表Distkey不仅仅是列误差



此语句在Redshift中创建一个表:

create table scoresc
distkey (metrics_id, scorefactors_id, tips_id)
compound sortkey (metrics_id, scorefactors_id, tips_id, expor_timestamp)
as select * from scores;

===为什么会出错?执行SQL命令时发生错误:

create table scoresc
distkey (metrics_id, scorefactors_id, tips_id)
compound sortkey (metrics_id, scorefactors_id, tips_id, export_timestamp...
[Amazon](500310) Invalid operation: syntax error at or near "," 
Position: 46;
distkey (metrics_id, scorefactors_id, tips_id)

=================RedShift文档未提供具有多列的DISTKEY示例

不确定您要使用的是什么,但是您只能在一个密钥上分发。Distkey的想法是提供一种在集群中均衡均匀分配表的方法,在此中,多个分发键对此没有太大的意义。

尝试仅使用一个Distkey,无论哪一个将在您的群集上最均匀地划分

如果您绝对确定需要通过所有这些列进行分发,则可以通过将这些列与某些定界线相结合,例如

来创建一个额外的串联键列

metrics_id||'-'||scorefactors_id||'-'||tips_id

并将其用作桌子的区域。

相关内容

最新更新