mirror of https://github.com/citusdata/citus.git
Add index tests to arbitrary configs (#5862)
parent
b52823f8b4
commit
1e1e66eeed
|
@ -5,3 +5,4 @@ test: local_dist_join_load
|
||||||
test: partitioned_indexes_create
|
test: partitioned_indexes_create
|
||||||
test: connectivity_checks
|
test: connectivity_checks
|
||||||
test: sequences_create
|
test: sequences_create
|
||||||
|
test: index_create
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
CREATE SCHEMA index_create;
|
||||||
|
SET search_path TO index_create;
|
||||||
|
CREATE TABLE test_tbl (a INT NOT NULL PRIMARY KEY, b text, c BIGINT);
|
||||||
|
CREATE UNIQUE INDEX CONCURRENTLY a_index ON test_tbl (a);
|
||||||
|
SELECT create_distributed_table('test_tbl','a');
|
||||||
|
create_distributed_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- suppress the WARNING message: not propagating CLUSTER command to worker nodes
|
||||||
|
SET client_min_messages TO ERROR;
|
||||||
|
CLUSTER test_tbl USING test_tbl_pkey;
|
||||||
|
RESET client_min_messages;
|
||||||
|
BEGIN;
|
||||||
|
CREATE INDEX idx1 ON test_tbl (a) INCLUDE (b, c);
|
||||||
|
DROP TABLE test_tbl;
|
||||||
|
ROLLBACK;
|
||||||
|
CREATE INDEX idx1 ON test_tbl (a) INCLUDE (b, c) WHERE a > 10;
|
||||||
|
CREATE INDEX idx2 ON test_tbl (lower(b));
|
||||||
|
CREATE TABLE partitioning_test(id int, time date) PARTITION BY RANGE (time);
|
||||||
|
-- create its partitions
|
||||||
|
CREATE TABLE partitioning_test_2009 PARTITION OF partitioning_test FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
|
||||||
|
CREATE TABLE partitioning_test_2010 PARTITION OF partitioning_test FOR VALUES FROM ('2010-01-01') TO ('2011-01-01');
|
||||||
|
-- create indexes on the parent
|
||||||
|
CREATE INDEX IF NOT EXISTS partitioned_idx_1 ON ONLY partitioning_test (id);
|
||||||
|
CREATE INDEX IF NOT EXISTS partitioned_idx_2 ON partitioning_test (id, time NULLS FIRST);
|
||||||
|
SELECT create_distributed_table('partitioning_test', 'id');
|
||||||
|
create_distributed_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- create hash index on distributed partitioned table
|
||||||
|
CREATE INDEX partition_idx_hash ON partitioning_test USING hash (id);
|
||||||
|
-- change statistics of index
|
||||||
|
ALTER INDEX idx2 ALTER COLUMN 1 SET STATISTICS 1000;
|
||||||
|
-- test reindex
|
||||||
|
REINDEX INDEX idx1;
|
||||||
|
ALTER TABLE test_tbl REPLICA IDENTITY USING INDEX a_index;
|
|
@ -0,0 +1,41 @@
|
||||||
|
CREATE SCHEMA index_create;
|
||||||
|
SET search_path TO index_create;
|
||||||
|
|
||||||
|
CREATE TABLE test_tbl (a INT NOT NULL PRIMARY KEY, b text, c BIGINT);
|
||||||
|
CREATE UNIQUE INDEX CONCURRENTLY a_index ON test_tbl (a);
|
||||||
|
SELECT create_distributed_table('test_tbl','a');
|
||||||
|
|
||||||
|
-- suppress the WARNING message: not propagating CLUSTER command to worker nodes
|
||||||
|
SET client_min_messages TO ERROR;
|
||||||
|
CLUSTER test_tbl USING test_tbl_pkey;
|
||||||
|
RESET client_min_messages;
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
CREATE INDEX idx1 ON test_tbl (a) INCLUDE (b, c);
|
||||||
|
DROP TABLE test_tbl;
|
||||||
|
ROLLBACK;
|
||||||
|
|
||||||
|
CREATE INDEX idx1 ON test_tbl (a) INCLUDE (b, c) WHERE a > 10;
|
||||||
|
CREATE INDEX idx2 ON test_tbl (lower(b));
|
||||||
|
|
||||||
|
CREATE TABLE partitioning_test(id int, time date) PARTITION BY RANGE (time);
|
||||||
|
-- create its partitions
|
||||||
|
CREATE TABLE partitioning_test_2009 PARTITION OF partitioning_test FOR VALUES FROM ('2009-01-01') TO ('2010-01-01');
|
||||||
|
CREATE TABLE partitioning_test_2010 PARTITION OF partitioning_test FOR VALUES FROM ('2010-01-01') TO ('2011-01-01');
|
||||||
|
|
||||||
|
-- create indexes on the parent
|
||||||
|
CREATE INDEX IF NOT EXISTS partitioned_idx_1 ON ONLY partitioning_test (id);
|
||||||
|
CREATE INDEX IF NOT EXISTS partitioned_idx_2 ON partitioning_test (id, time NULLS FIRST);
|
||||||
|
|
||||||
|
SELECT create_distributed_table('partitioning_test', 'id');
|
||||||
|
|
||||||
|
-- create hash index on distributed partitioned table
|
||||||
|
CREATE INDEX partition_idx_hash ON partitioning_test USING hash (id);
|
||||||
|
|
||||||
|
-- change statistics of index
|
||||||
|
ALTER INDEX idx2 ALTER COLUMN 1 SET STATISTICS 1000;
|
||||||
|
|
||||||
|
-- test reindex
|
||||||
|
REINDEX INDEX idx1;
|
||||||
|
|
||||||
|
ALTER TABLE test_tbl REPLICA IDENTITY USING INDEX a_index;
|
Loading…
Reference in New Issue