mirror of https://github.com/citusdata/citus.git
66 lines
2.9 KiB
Plaintext
66 lines
2.9 KiB
Plaintext
CREATE SCHEMA citus_shards;
|
|
SET search_path TO citus_shards;
|
|
SET citus.shard_count TO 4;
|
|
SET citus.shard_replication_factor TO 1;
|
|
SET citus.next_shard_id TO 99456900;
|
|
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 456900;
|
|
CREATE TABLE t1 (i int);
|
|
SELECT create_distributed_table('t1', 'i');
|
|
create_distributed_table
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
CREATE TABLE "t with space" (i int);
|
|
SELECT create_distributed_table('"t with space"', 'i');
|
|
create_distributed_table
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
INSERT INTO t1 SELECT generate_series(1, 100);
|
|
INSERT INTO "t with space" SELECT generate_series(1, 1000);
|
|
SELECT * FROM citus_shards;
|
|
table_name | shardid | shard_name | citus_table_type | colocation_id | nodename | nodeport | shard_size
|
|
---------------------------------------------------------------------
|
|
"t with space" | 99456904 | citus_shards."t with space_99456904" | distributed | 456900 | localhost | 57637 | 40960
|
|
"t with space" | 99456905 | citus_shards."t with space_99456905" | distributed | 456900 | localhost | 57638 | 40960
|
|
"t with space" | 99456906 | citus_shards."t with space_99456906" | distributed | 456900 | localhost | 57637 | 40960
|
|
"t with space" | 99456907 | citus_shards."t with space_99456907" | distributed | 456900 | localhost | 57638 | 40960
|
|
t1 | 99456900 | citus_shards.t1_99456900 | distributed | 456900 | localhost | 57637 | 8192
|
|
t1 | 99456901 | citus_shards.t1_99456901 | distributed | 456900 | localhost | 57638 | 8192
|
|
t1 | 99456902 | citus_shards.t1_99456902 | distributed | 456900 | localhost | 57637 | 8192
|
|
t1 | 99456903 | citus_shards.t1_99456903 | distributed | 456900 | localhost | 57638 | 8192
|
|
(8 rows)
|
|
|
|
SET search_path TO public;
|
|
CREATE TABLE t3 (i int);
|
|
SELECT citus_add_local_table_to_metadata('t3');
|
|
citus_add_local_table_to_metadata
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT shard_name('t3', shardid) FROM pg_dist_shard WHERE logicalrelid = 't3'::regclass;
|
|
shard_name
|
|
---------------------------------------------------------------------
|
|
t3_99456908
|
|
(1 row)
|
|
|
|
SELECT shard_name('t3', shardid, true) FROM pg_dist_shard WHERE logicalrelid = 't3'::regclass;
|
|
shard_name
|
|
---------------------------------------------------------------------
|
|
t3_99456908
|
|
(1 row)
|
|
|
|
SELECT shard_name('t3', shardid, false) FROM pg_dist_shard WHERE logicalrelid = 't3'::regclass;
|
|
shard_name
|
|
---------------------------------------------------------------------
|
|
public.t3_99456908
|
|
(1 row)
|
|
|
|
DROP TABLE t3;
|
|
SET search_path TO citus_shards;
|
|
SET client_min_messages TO WARNING;
|
|
DROP SCHEMA citus_shards CASCADE;
|