创建示例表
tpcds.
customer_address_p1。
DROP TABLE IF EXISTS tpcds.customer_address_p1;
CREATE TABLE tpcds.customer_address_p1
CA_ADDRESS_SK INTEGER NOT NULL,
CA_ADDRESS_ID CHAR(16) NOT NULL,
CA_STREET_NUMBER CHAR(10) ,
CA_STREET_NAME VARCHAR(60) ,
CA_STREET_TYPE CHAR(15) ,
CA_SUITE_NUMBER CHAR(10) ,
CA_CITY VARCHAR(60) ,
CA_COUNTY VARCHAR(30) ,
CA_STATE CHAR(2) ,
CA_ZIP CHAR(10) ,
CA_COUNTRY VARCHAR(20) ,
CA_GMT_OFFSET DECIMAL(5,2) ,
CA_LOCATION_TYPE CHAR(20)
DISTRIBUTE BY HASH(CA_ADDRESS_SK)
PARTITION BY RANGE(CA_ADDRESS_SK)
PARTITION p1 VALUES LESS THAN (3000),
PARTITION p2 VALUES LESS THAN (5000) ,
PARTITION p3 VALUES LESS THAN (MAXVALUE)
ENABLE ROW MOVEMENT;
CREATE INDEX ds_customer_address_p1_index2 ON tpcds.customer_address_p1(CA_ADDRESS_SK) LOCAL
PARTITION CA_ADDRESS_SK_index1,
PARTITION CA_ADDRESS_SK_index2,
PARTITION CA_ADDRESS_SK_index3
CREATE INDEX ds_customer_address_p1_index_comment ON tpcds.customer_address_p1(CA_ADDRESS_SK) COMMENT 'index' LOCAL
PARTITION CA_ADDRESS_SK_index1,
PARTITION CA_ADDRESS_SK_index2,
PARTITION CA_ADDRESS_SK_index3