mirror of
https://github.com/postgres/postgres.git
synced 2025-12-13 14:22:43 +03:00
Add ALTER TABLE <tablename> CLUSTER ON <indexname>
Alvaro Herrera
This commit is contained in:
@@ -285,6 +285,18 @@ WHERE pg_class.oid=indexrelid
|
||||
clstr_tst_c
|
||||
(1 row)
|
||||
|
||||
-- Try changing indisclustered
|
||||
ALTER TABLE clstr_tst CLUSTER ON clstr_tst_b_c;
|
||||
SELECT pg_class.relname FROM pg_index, pg_class, pg_class AS pg_class_2
|
||||
WHERE pg_class.oid=indexrelid
|
||||
AND indrelid=pg_class_2.oid
|
||||
AND pg_class_2.relname = 'clstr_tst'
|
||||
AND indisclustered;
|
||||
relname
|
||||
---------------
|
||||
clstr_tst_b_c
|
||||
(1 row)
|
||||
|
||||
-- Verify that clustering all tables does in fact cluster the right ones
|
||||
CREATE USER clstr_user;
|
||||
CREATE TABLE clstr_1 (a INT PRIMARY KEY);
|
||||
|
||||
@@ -87,6 +87,14 @@ WHERE pg_class.oid=indexrelid
|
||||
AND pg_class_2.relname = 'clstr_tst'
|
||||
AND indisclustered;
|
||||
|
||||
-- Try changing indisclustered
|
||||
ALTER TABLE clstr_tst CLUSTER ON clstr_tst_b_c;
|
||||
SELECT pg_class.relname FROM pg_index, pg_class, pg_class AS pg_class_2
|
||||
WHERE pg_class.oid=indexrelid
|
||||
AND indrelid=pg_class_2.oid
|
||||
AND pg_class_2.relname = 'clstr_tst'
|
||||
AND indisclustered;
|
||||
|
||||
-- Verify that clustering all tables does in fact cluster the right ones
|
||||
CREATE USER clstr_user;
|
||||
CREATE TABLE clstr_1 (a INT PRIMARY KEY);
|
||||
|
||||
Reference in New Issue
Block a user