Last active
June 15, 2020 13:05
-
-
Save onderkalaci/a9856bfc8b242ee154e55b6486a48524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE SCHEMA "CiTUS!LocalTables"; | |
-- create table with weird names | |
CREATE TABLE "CiTUS!LocalTables"."LocalTabLE.1!?!"(id int, "TeNANt_Id" int); | |
SELECT create_citus_local_table('"CiTUS!LocalTables"."LocalTabLE.1!?!"'); | |
-- now create the local table when the search path is set | |
SET search_path TO "CiTUS!LocalTables"; | |
DROP TABLE "LocalTabLE.1!?!"; | |
-- have a custom type in the local table | |
CREATE TYPE local_table_table AS (key int, value jsonb); | |
CREATE TABLE "LocalTabLE.1!?!"(id int PRIMARY KEY, "TeNANt_Id" int, "local_Type" local_table_table, "jsondata" jsonb NOT NULL, name text, price numeric CHECK (price > 0), serial_data bigserial, UNIQUE (id, price), EXCLUDE USING GIST (name WITH =)); | |
-- create a basic index before create_citus_local_table table | |
CREATE INDEX "my!Index1" ON "LocalTabLE.1!?!"(id) WITH ( fillfactor = 80 ) WHERE id > 10; | |
-- create a unique index before create_citus_local_table table | |
CREATE UNIQUE INDEX uniqueIndex ON (id); | |
-- ingest some data before create_citus_local_table | |
INSERT INTO "LocalTabLE.1!?!" VALUES (1, 1, "(1, row_to_json(row(1,1)))", row_to_json(row(1,1), "user_1", 1), (1, 1, "(2, row_to_json(row(2,2)))", row_to_json(row(2,2) "user_2", 2); | |
-- create a replica identity before create_citus_local_table table | |
ALTER TABLE "LocalTabLE.1!?!" REPLICA IDENTITY USING INDEX uniqueIndex; | |
SELECT create_citus_local_table('"LocalTabLE.1!?!"'); | |
-- create a basic index after create_citus_local_table table | |
CREATE INDEX "my!Index2" ON "LocalTabLE.1!?!"(id) WITH ( fillfactor = 90 ) WHERE id < 20; | |
-- create a unique index after create_citus_local_table table | |
CREATE UNIQUE INDEX uniqueIndex ON (id); | |
-- things to test: | |
(a) create local table while running pgbench | |
(b) transaction blocks + foreign keys + sequential execution | |
(c) unlogged / temporary tables | |
(d) compex triggers | |
(e) TRUNCATE | |
(f) metadata correctness | |
(g) MX | |
(h) sequences | |
(i) replica identity | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I played a bit to resolve errors: