Specify the storage option for TOAST table when create table.
The storage option such as AUTOVACUUM_VACUUM_SCALE_FACTOR can be set to both heap table and TOAST table. But the storage parameter for TOAST table had gone after repacked. This change create new function get_storage_param which returns all storage paramters including for TOAST table and OID setting. Issue #10.
This commit is contained in:
committed by
Daniele Varrazzo
parent
6d7b1dbca4
commit
ca5ca11d4d
@ -58,6 +58,12 @@ CREATE INDEX idxopts_t ON tbl_idxopts (t DESC NULLS LAST) WHERE (t != 'aaa');
|
||||
-- Use this table to play with attribute options too
|
||||
ALTER TABLE tbl_idxopts ALTER i SET STATISTICS 1;
|
||||
ALTER TABLE tbl_idxopts ALTER t SET (n_distinct = -0.5);
|
||||
CREATE TABLE tbl_with_toast (
|
||||
i integer PRIMARY KEY,
|
||||
c text
|
||||
);
|
||||
ALTER TABLE tbl_with_toast SET (AUTOVACUUM_VACUUM_SCALE_FACTOR = 30, AUTOVACUUM_VACUUM_THRESHOLD = 300);
|
||||
ALTER TABLE tbl_with_toast SET (TOAST.AUTOVACUUM_VACUUM_SCALE_FACTOR = 40, TOAST.AUTOVACUUM_VACUUM_THRESHOLD = 400);
|
||||
--
|
||||
-- insert data
|
||||
--
|
||||
@ -131,6 +137,7 @@ INFO: repacking table "tbl_with_dropped_toast"
|
||||
INFO: repacking table "tbl_badindex"
|
||||
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
|
||||
INFO: repacking table "tbl_idxopts"
|
||||
INFO: repacking table "tbl_with_toast"
|
||||
--
|
||||
-- after
|
||||
--
|
||||
@ -285,6 +292,20 @@ SELECT * FROM tbl_with_dropped_toast;
|
||||
|
||||
RESET enable_seqscan;
|
||||
RESET enable_indexscan;
|
||||
-- check if storage option for both table and TOAST table didn't go away.
|
||||
SELECT CASE relkind
|
||||
WHEN 'r' THEN relname
|
||||
WHEN 't' THEN 'toast_table'
|
||||
END as table,
|
||||
reloptions
|
||||
FROM pg_class
|
||||
WHERE relname = 'tbl_with_toast' OR relname = 'pg_toast_' || 'tbl_with_toast'::regclass::oid;
|
||||
table | reloptions
|
||||
----------------+---------------------------------------------------------------------
|
||||
toast_table | {autovacuum_vacuum_scale_factor=40,autovacuum_vacuum_threshold=400}
|
||||
tbl_with_toast | {autovacuum_vacuum_scale_factor=30,autovacuum_vacuum_threshold=300}
|
||||
(2 rows)
|
||||
|
||||
--
|
||||
-- check broken links or orphan toast relations
|
||||
--
|
||||
|
@ -69,6 +69,12 @@ CREATE INDEX idxopts_t ON tbl_idxopts (t DESC NULLS LAST) WHERE (t != 'aaa');
|
||||
-- Use this table to play with attribute options too
|
||||
ALTER TABLE tbl_idxopts ALTER i SET STATISTICS 1;
|
||||
ALTER TABLE tbl_idxopts ALTER t SET (n_distinct = -0.5);
|
||||
CREATE TABLE tbl_with_toast (
|
||||
i integer PRIMARY KEY,
|
||||
c text
|
||||
);
|
||||
ALTER TABLE tbl_with_toast SET (AUTOVACUUM_VACUUM_SCALE_FACTOR = 30, AUTOVACUUM_VACUUM_THRESHOLD = 300);
|
||||
ALTER TABLE tbl_with_toast SET (TOAST.AUTOVACUUM_VACUUM_SCALE_FACTOR = 40, TOAST.AUTOVACUUM_VACUUM_THRESHOLD = 400);
|
||||
|
||||
--
|
||||
-- insert data
|
||||
@ -157,6 +163,14 @@ SELECT * FROM view_for_dropped_column;
|
||||
SELECT * FROM tbl_with_dropped_toast;
|
||||
RESET enable_seqscan;
|
||||
RESET enable_indexscan;
|
||||
-- check if storage option for both table and TOAST table didn't go away.
|
||||
SELECT CASE relkind
|
||||
WHEN 'r' THEN relname
|
||||
WHEN 't' THEN 'toast_table'
|
||||
END as table,
|
||||
reloptions
|
||||
FROM pg_class
|
||||
WHERE relname = 'tbl_with_toast' OR relname = 'pg_toast_' || 'tbl_with_toast'::regclass::oid;
|
||||
|
||||
--
|
||||
-- check broken links or orphan toast relations
|
||||
|
Reference in New Issue
Block a user