mirror of https://github.com/citusdata/citus.git
parent
6c333d464f
commit
257d9b49fd
|
@ -66,3 +66,37 @@ SELECT master_apply_delete_command('DELETE FROM sharded_table');
|
|||
|
||||
-- drop table
|
||||
DROP TABLE sharded_table;
|
||||
-- VACUUM tests
|
||||
-- create a table with a single shard (for convenience)
|
||||
CREATE TABLE dustbunnies (id integer, name text);
|
||||
SELECT master_create_distributed_table('dustbunnies', 'id', 'hash');
|
||||
master_create_distributed_table
|
||||
---------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT master_create_worker_shards('dustbunnies', 1, 2);
|
||||
master_create_worker_shards
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- add some data to the distributed table
|
||||
\copy dustbunnies from stdin with csv
|
||||
-- delete all rows from the shard, then run VACUUM against the table on the master
|
||||
DELETE FROM dustbunnies;
|
||||
VACUUM dustbunnies;
|
||||
-- update statistics, then verify that the four dead rows are gone
|
||||
\c - - - :worker_1_port
|
||||
SELECT pg_sleep(.500);
|
||||
pg_sleep
|
||||
----------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT pg_stat_get_vacuum_count('dustbunnies_990002'::regclass);
|
||||
pg_stat_get_vacuum_count
|
||||
--------------------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
|
|
|
@ -40,3 +40,27 @@ SELECT master_apply_delete_command('DELETE FROM sharded_table');
|
|||
|
||||
-- drop table
|
||||
DROP TABLE sharded_table;
|
||||
|
||||
-- VACUUM tests
|
||||
|
||||
-- create a table with a single shard (for convenience)
|
||||
CREATE TABLE dustbunnies (id integer, name text);
|
||||
SELECT master_create_distributed_table('dustbunnies', 'id', 'hash');
|
||||
SELECT master_create_worker_shards('dustbunnies', 1, 2);
|
||||
|
||||
-- add some data to the distributed table
|
||||
\copy dustbunnies from stdin with csv
|
||||
1,bugs
|
||||
2,babs
|
||||
3,buster
|
||||
4,roger
|
||||
\.
|
||||
|
||||
-- delete all rows from the shard, then run VACUUM against the table on the master
|
||||
DELETE FROM dustbunnies;
|
||||
VACUUM dustbunnies;
|
||||
|
||||
-- update statistics, then verify that the four dead rows are gone
|
||||
\c - - - :worker_1_port
|
||||
SELECT pg_sleep(.500);
|
||||
SELECT pg_stat_get_vacuum_count('dustbunnies_990002'::regclass);
|
||||
|
|
Loading…
Reference in New Issue