SnowConvert AI :Greenplum CREATE TABLE

GreenplumからSnowflakeへの変換

説明

このセクションでは、Greenplum独自の機能について説明します。

詳しくは [CREATE TABLE](https://techdocs.broadcom.com/us/en/vmware-tanzu/data-solutions/tanzu-greenplum/7/greenplum-database/ref_guide-sql_commands-CREATE_TABLE.html)のドキュメントを参照してください。

文法構文

CREATE TABLE <table_name> ( 
  [ <column_name> <data_type> [ ENCODING ( <storage_directive> [, ...] ) ]
] )
[ DISTRIBUTED BY ( <column> [<opclass>] [, ... ] ) 
    | DISTRIBUTED RANDOMLY
    | DISTRIBUTED REPLICATED ]
Copy

ENCODING

注釈

Snowflakeではこの構文は必要ありません。

列の圧縮エンコーディング。Snowflakeでは、ENCODING を定義する必要はありません。Greenplumではエンコーディングを手動で設定できますが、Snowflakeではデータ圧縮が自動的に処理されるためです。このため、ENCODING ステートメントは移行中に削除されます。

文法構文

ENCODING ( <storage_directive> [, ...] )
Copy

サンプルソース

入力コード:

Greenplum
CREATE TABLE TABLE1 (
   COL1 integer ENCODING (compresstype = quicklz, blocksize = 65536)
);
Copy

出力コード:

Snowflake
CREATE TABLE TABLE1 (
   COL1 integer
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "greenplum",  "convertedOn": "03/26/2025",  "domain": "test" }}'
;
Copy

DISTRIBUTED に BY

Hint

この構文はSnowflakeで完全にサポートされています。

Greenplumの DISTRIBUTED BY 句は、テーブルデータが物理的にどのようにシステムのセグメントに分散されるかを制御します。一方、CLUSTER BY は、テーブル内の列(またはテーブル上の式)のサブセットであり、テーブル内のデータを同じマイクロパーティションに共存させるように明示的に指定されます。

文法構文

DISTRIBUTED BY ( <column> [<opclass>] [, ... ] )
Copy

サンプルソースパターン

入力コード:

Greenplum
CREATE TABLE table1 (colum1 int, colum2 int, colum3 smallint, colum4 int )
DISTRIBUTED BY (colum1, colum2);
Copy

出力コード:

Snowflake
CREATE TABLE table1 (colum1 int, colum2 int, colum3 smallint, colum4 int )
--** SSC-FDM-GP0001 - THE PERFORMANCE OF THE CLUSTER BY MAY VARY COMPARED TO THE PERFORMANCE OF DISTRIBUTED BY **
CLUSTER BY (colum1, colum2)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "greenplum",  "convertedOn": "03/26/2025",  "domain": "test" }}'
;
Copy

DISTRIBUTED RANDOMLY - REPLICATED

注釈

Snowflakeではこの構文は必要ありません。

GreenplumのDISTRIBUTED REPLICATED またはDISTRIBUTED RANDOMLY 句は、テーブルデータがシステムのセグメント間で物理的にどのように分散されるかを制御します。Snowflakeは自動的にデータストレージを処理するため、これらのオプションは移行時に削除されます。

文法構文

DISTRIBUTED RANDOMLY | DISTRIBUTED REPLICATED
Copy

サンプルソースパターン

入力コード:

Greenplum
CREATE TABLE table1 (colum1 int, colum2 int, colum3 smallint, colum4 int )
DISTRIBUTED RANDOMLY;
Copy

出力コード:

Snowflake
CREATE TABLE table1 (colum1 int, colum2 int, colum3 smallint, colum4 int )
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "greenplum",  "convertedOn": "03/26/2025",  "domain": "test" }}'
;
Copy