SELECT i, (i * 10), date '2013-09-01 03:04:05' + i * '1 day'::interval
FROM generate_series(1, 1000)i;
INSERT 0 1000
DROP TABLE IF EXISTS users_rank_1;
DROP TABLE IF EXISTS users_rank_third_to_last;
DROP TABLE
CREATE TABLE users_rank_1 (
CREATE TABLE users_rank_third_to_last (
id INT4,
name TEXT,
age INT4
...
...
@@ -371,49 +371,29 @@ CREATE TABLE users_rank_1 (
psql:/path/sql_file:1: NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
INSERT INTO users_rank_1 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT INTO users_rank_third_to_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT 0 1000
DROP TABLE IF EXISTS users_rank_3;
DROP TABLE IF EXISTS users_rank_second_to_last;
DROP TABLE
CREATE TABLE users_rank_3 (
CREATE TABLE users_rank_second_to_last (
id SERIAL,
name TEXT,
age INT4
) DISTRIBUTED BY (age);
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "users_rank_3_id_seq" for serial column "users_rank_3.id"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "users_rank_second_to_last_id_seq" for serial column "users_rank_second_to_last.id"
CREATE TABLE
INSERT INTO users_rank_3 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT INTO users_rank_second_to_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT 0 1000
DROP TABLE IF EXISTS users_rank_2;
DROP TABLE IF EXISTS users_rank_very_last;
DROP TABLE
CREATE TABLE users_rank_2 (
CREATE TABLE users_rank_very_last (
id SERIAL,
name TEXT,
age INT4
) DISTRIBUTED RANDOMLY;
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "users_rank_2_id_seq" for serial column "users_rank_2.id"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create implicit sequence "users_rank_very_last_id_seq" for serial column "users_rank_very_last.id"
CREATE TABLE
INSERT INTO users_rank_2 select i, 'name'||i, i%50+1 from generate_series(1,1000) i;
INSERT 0 1000
DROP TABLE IF EXISTS users_rank_10;
DROP TABLE
CREATE TABLE users_rank_10(
a text,
b int,
c text,
d timestamp
)
distributed by (a)
PARTITION BY RANGE(b) (START (0) END (100) INCLUSIVE EVERY(20));
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_1" for table "users_rank_10"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_2" for table "users_rank_10"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_3" for table "users_rank_10"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_4" for table "users_rank_10"
psql:/path/sql_file:1: NOTICE: CREATE TABLE will create partition "users_rank_10_1_prt_5" for table "users_rank_10"
CREATE TABLE
INSERT INTO users_rank_10
SELECT i, (i * 10) % 100, i::text, '2013-09-01 03:04:05'
FROM generate_series(1, 1000)i;
INSERT INTO users_rank_very_last select i, 'name'||i, i%50+1 from generate_series(1,1000) i;