Merge branch 'master' into toast_storage_param
This commit is contained in:
@ -64,6 +64,11 @@ CREATE TABLE tbl_with_toast (
|
||||
);
|
||||
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);
|
||||
CREATE TABLE tbl_with_mod_column_storage (
|
||||
id integer PRIMARY KEY,
|
||||
c text
|
||||
);
|
||||
ALTER TABLE tbl_with_mod_column_storage ALTER c SET STORAGE MAIN;
|
||||
--
|
||||
-- insert data
|
||||
--
|
||||
@ -91,6 +96,8 @@ INSERT INTO tbl_with_dropped_toast VALUES(2, 20, sqrt(2::numeric(1000,999))::tex
|
||||
ALTER TABLE tbl_with_dropped_toast DROP COLUMN t;
|
||||
INSERT INTO tbl_badindex VALUES(1, 10);
|
||||
INSERT INTO tbl_badindex VALUES(2, 10);
|
||||
-- insert data that is always stored into the toast table if column type is extended.
|
||||
INSERT INTO tbl_with_mod_column_storage SELECT 1, array_to_string(ARRAY(SELECT chr(code) FROM generate_series(33,3000) code), '');
|
||||
-- This will fail. Silence the message as it's different across PG versions.
|
||||
SET client_min_messages = fatal;
|
||||
CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n);
|
||||
@ -138,6 +145,7 @@ 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"
|
||||
INFO: repacking table "tbl_with_mod_column_storage"
|
||||
--
|
||||
-- after
|
||||
--
|
||||
@ -213,14 +221,14 @@ Indexes:
|
||||
"tbl_idxopts_pkey" PRIMARY KEY, btree (i)
|
||||
"idxopts_t" btree (t DESC NULLS LAST) WHERE t <> 'aaa'::text
|
||||
|
||||
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
|
||||
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster ORDER BY 1, 2;
|
||||
col1 | to_char | ,")
|
||||
------+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
1 | 2008-12-31 10:00:00 | admin
|
||||
2 | 2008-01-01 00:00:00 | king
|
||||
5 | 2008-01-01 00:30:00 | 1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727350138462309122970249248360558507372126441214970999358314132226659275055927557999505011527820605714701095599716059702745345968620147285174186408891986095523292304843087143214508397626036279952514079896872533965463318088296406206152583523950547457502877599617298355752203375318570113543746034084988471603868999706990048150305440277903164542478230684929369186215805784631115966687130130156185689872372352885092648612494977154218334204285686060146824720771435854874155657069677653720226485447015858801620758474922657226002085584466521458398893944370926591800311388246468157082630100594858704003186480342194897278290641045072636881313739855256117322040245091227700226941127573627280495738108967504018369868368450725799364729060762996941380475654823728997180326802474420629269124859052181004459842150591120249441341728531478105803603371077309182869314710171111683916581726889419758716582152128229518488471.732050807568877293527446341505872366942805253810380628055806979451933016908800037081146186757248575675626141415406703029969945094998952478811655512094373648528093231902305582067974820101084674923265015312343266903322886650672254668921837971227047131660367861588019049986537379859389467650347506576050756618348129606100947602187190325083145829523959832997789824508288714463832917347224163984587855397667958063818353666110843173780894378316102088305524901670023520711144288695990956365797087168498072899493296484283020786408603988738697537582317317831395992983007838702877053913369563312103707264019249106768231199288375641141422016742752102372994270831059898459475987664288897796147837958390228854852903576033852808064381972344661059689722872865264153822664698420021195484155278441181286534507035191650016689294415480846071277143999762926834629577438361895110127148638746976545982451788550975379013880664961911962222957110555242923723192197738262561631468842032853716682938649611917049738836395495938
|
||||
3 | 2008-03-04 12:00:00 | joker
|
||||
4 | 2008-03-05 15:00:00 | queen
|
||||
1 | 2008-12-31 10:00:00 | admin
|
||||
5 | 2008-01-01 00:30:00 | 1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727350138462309122970249248360558507372126441214970999358314132226659275055927557999505011527820605714701095599716059702745345968620147285174186408891986095523292304843087143214508397626036279952514079896872533965463318088296406206152583523950547457502877599617298355752203375318570113543746034084988471603868999706990048150305440277903164542478230684929369186215805784631115966687130130156185689872372352885092648612494977154218334204285686060146824720771435854874155657069677653720226485447015858801620758474922657226002085584466521458398893944370926591800311388246468157082630100594858704003186480342194897278290641045072636881313739855256117322040245091227700226941127573627280495738108967504018369868368450725799364729060762996941380475654823728997180326802474420629269124859052181004459842150591120249441341728531478105803603371077309182869314710171111683916581726889419758716582152128229518488471.732050807568877293527446341505872366942805253810380628055806979451933016908800037081146186757248575675626141415406703029969945094998952478811655512094373648528093231902305582067974820101084674923265015312343266903322886650672254668921837971227047131660367861588019049986537379859389467650347506576050756618348129606100947602187190325083145829523959832997789824508288714463832917347224163984587855397667958063818353666110843173780894378316102088305524901670023520711144288695990956365797087168498072899493296484283020786408603988738697537582317317831395992983007838702877053913369563312103707264019249106768231199288375641141422016742752102372994270831059898459475987664288897796147837958390228854852903576033852808064381972344661059689722872865264153822664698420021195484155278441181286534507035191650016689294415480846071277143999762926834629577438361895110127148638746976545982451788550975379013880664961911962222957110555242923723192197738262561631468842032853716682938649611917049738836395495938
|
||||
(5 rows)
|
||||
|
||||
SELECT * FROM tbl_only_ckey ORDER BY 1;
|
||||
@ -246,14 +254,14 @@ SELECT * FROM tbl_gistkey ORDER BY 1;
|
||||
|
||||
SET enable_seqscan = on;
|
||||
SET enable_indexscan = off;
|
||||
SELECT * FROM tbl_with_dropped_column;
|
||||
SELECT * FROM tbl_with_dropped_column ;
|
||||
c1 | id | c2 | c3
|
||||
----+----+----+----
|
||||
c1 | 1 | c2 |
|
||||
c1 | 2 | c2 |
|
||||
c1 | 1 | c2 |
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM view_for_dropped_column;
|
||||
SELECT * FROM view_for_dropped_column ORDER BY 1, 2;
|
||||
c1 | id | c2 | c3
|
||||
----+----+----+----
|
||||
c1 | 1 | c2 |
|
||||
@ -269,7 +277,7 @@ SELECT * FROM tbl_with_dropped_toast;
|
||||
|
||||
SET enable_seqscan = off;
|
||||
SET enable_indexscan = on;
|
||||
SELECT * FROM tbl_with_dropped_column;
|
||||
SELECT * FROM tbl_with_dropped_column ORDER BY 1, 2;
|
||||
c1 | id | c2 | c3
|
||||
----+----+----+----
|
||||
c1 | 1 | c2 |
|
||||
@ -279,8 +287,8 @@ SELECT * FROM tbl_with_dropped_column;
|
||||
SELECT * FROM view_for_dropped_column;
|
||||
c1 | id | c2 | c3
|
||||
----+----+----+----
|
||||
c1 | 1 | c2 |
|
||||
c1 | 2 | c2 |
|
||||
c1 | 1 | c2 |
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM tbl_with_dropped_toast;
|
||||
@ -306,6 +314,11 @@ ORDER BY 1;
|
||||
tbl_with_toast | {autovacuum_vacuum_scale_factor=30,autovacuum_vacuum_threshold=300}
|
||||
toast_table | {autovacuum_vacuum_scale_factor=40,autovacuum_vacuum_threshold=400}
|
||||
(2 rows)
|
||||
SELECT pg_relation_size(reltoastrelid) = 0 as check_toast_rel_size FROM pg_class WHERE relname = 'tbl_with_mod_column_storage';
|
||||
check_toast_rel_size
|
||||
----------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
--
|
||||
-- check broken links or orphan toast relations
|
||||
|
@ -64,6 +64,11 @@ CREATE TABLE tbl_with_toast (
|
||||
);
|
||||
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);
|
||||
CREATE TABLE tbl_with_mod_column_storage (
|
||||
id integer PRIMARY KEY,
|
||||
c text
|
||||
);
|
||||
ALTER TABLE tbl_with_mod_column_storage ALTER c SET STORAGE MAIN;
|
||||
--
|
||||
-- insert data
|
||||
--
|
||||
@ -91,6 +96,8 @@ INSERT INTO tbl_with_dropped_toast VALUES(2, 20, sqrt(2::numeric(1000,999))::tex
|
||||
ALTER TABLE tbl_with_dropped_toast DROP COLUMN t;
|
||||
INSERT INTO tbl_badindex VALUES(1, 10);
|
||||
INSERT INTO tbl_badindex VALUES(2, 10);
|
||||
-- insert data that is always stored into the toast table if column type is extended.
|
||||
INSERT INTO tbl_with_mod_column_storage SELECT 1, array_to_string(ARRAY(SELECT chr(code) FROM generate_series(33,3000) code), '');
|
||||
-- This will fail. Silence the message as it's different across PG versions.
|
||||
SET client_min_messages = fatal;
|
||||
CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n);
|
||||
@ -138,6 +145,7 @@ 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"
|
||||
INFO: repacking table "tbl_with_mod_column_storage"
|
||||
--
|
||||
-- after
|
||||
--
|
||||
@ -213,14 +221,14 @@ Indexes:
|
||||
"tbl_idxopts_pkey" PRIMARY KEY, btree (i)
|
||||
"idxopts_t" btree (t DESC NULLS LAST) WHERE t <> 'aaa'::text
|
||||
|
||||
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster;
|
||||
SELECT col1, to_char("time", 'YYYY-MM-DD HH24:MI:SS'), ","")" FROM tbl_cluster ORDER BY 1, 2;
|
||||
col1 | to_char | ,")
|
||||
------+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
1 | 2008-12-31 10:00:00 | admin
|
||||
2 | 2008-01-01 00:00:00 | king
|
||||
5 | 2008-01-01 00:30:00 | 1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727350138462309122970249248360558507372126441214970999358314132226659275055927557999505011527820605714701095599716059702745345968620147285174186408891986095523292304843087143214508397626036279952514079896872533965463318088296406206152583523950547457502877599617298355752203375318570113543746034084988471603868999706990048150305440277903164542478230684929369186215805784631115966687130130156185689872372352885092648612494977154218334204285686060146824720771435854874155657069677653720226485447015858801620758474922657226002085584466521458398893944370926591800311388246468157082630100594858704003186480342194897278290641045072636881313739855256117322040245091227700226941127573627280495738108967504018369868368450725799364729060762996941380475654823728997180326802474420629269124859052181004459842150591120249441341728531478105803603371077309182869314710171111683916581726889419758716582152128229518488471.732050807568877293527446341505872366942805253810380628055806979451933016908800037081146186757248575675626141415406703029969945094998952478811655512094373648528093231902305582067974820101084674923265015312343266903322886650672254668921837971227047131660367861588019049986537379859389467650347506576050756618348129606100947602187190325083145829523959832997789824508288714463832917347224163984587855397667958063818353666110843173780894378316102088305524901670023520711144288695990956365797087168498072899493296484283020786408603988738697537582317317831395992983007838702877053913369563312103707264019249106768231199288375641141422016742752102372994270831059898459475987664288897796147837958390228854852903576033852808064381972344661059689722872865264153822664698420021195484155278441181286534507035191650016689294415480846071277143999762926834629577438361895110127148638746976545982451788550975379013880664961911962222957110555242923723192197738262561631468842032853716682938649611917049738836395495938
|
||||
3 | 2008-03-04 12:00:00 | joker
|
||||
4 | 2008-03-05 15:00:00 | queen
|
||||
1 | 2008-12-31 10:00:00 | admin
|
||||
5 | 2008-01-01 00:30:00 | 1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727350138462309122970249248360558507372126441214970999358314132226659275055927557999505011527820605714701095599716059702745345968620147285174186408891986095523292304843087143214508397626036279952514079896872533965463318088296406206152583523950547457502877599617298355752203375318570113543746034084988471603868999706990048150305440277903164542478230684929369186215805784631115966687130130156185689872372352885092648612494977154218334204285686060146824720771435854874155657069677653720226485447015858801620758474922657226002085584466521458398893944370926591800311388246468157082630100594858704003186480342194897278290641045072636881313739855256117322040245091227700226941127573627280495738108967504018369868368450725799364729060762996941380475654823728997180326802474420629269124859052181004459842150591120249441341728531478105803603371077309182869314710171111683916581726889419758716582152128229518488471.732050807568877293527446341505872366942805253810380628055806979451933016908800037081146186757248575675626141415406703029969945094998952478811655512094373648528093231902305582067974820101084674923265015312343266903322886650672254668921837971227047131660367861588019049986537379859389467650347506576050756618348129606100947602187190325083145829523959832997789824508288714463832917347224163984587855397667958063818353666110843173780894378316102088305524901670023520711144288695990956365797087168498072899493296484283020786408603988738697537582317317831395992983007838702877053913369563312103707264019249106768231199288375641141422016742752102372994270831059898459475987664288897796147837958390228854852903576033852808064381972344661059689722872865264153822664698420021195484155278441181286534507035191650016689294415480846071277143999762926834629577438361895110127148638746976545982451788550975379013880664961911962222957110555242923723192197738262561631468842032853716682938649611917049738836395495938
|
||||
(5 rows)
|
||||
|
||||
SELECT * FROM tbl_only_ckey ORDER BY 1;
|
||||
@ -246,14 +254,14 @@ SELECT * FROM tbl_gistkey ORDER BY 1;
|
||||
|
||||
SET enable_seqscan = on;
|
||||
SET enable_indexscan = off;
|
||||
SELECT * FROM tbl_with_dropped_column;
|
||||
SELECT * FROM tbl_with_dropped_column ;
|
||||
c1 | id | c2 | c3
|
||||
----+----+----+----
|
||||
c1 | 1 | c2 |
|
||||
c1 | 2 | c2 |
|
||||
c1 | 1 | c2 |
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM view_for_dropped_column;
|
||||
SELECT * FROM view_for_dropped_column ORDER BY 1, 2;
|
||||
c1 | id | c2 | c3
|
||||
----+----+----+----
|
||||
c1 | 1 | c2 |
|
||||
@ -269,7 +277,7 @@ SELECT * FROM tbl_with_dropped_toast;
|
||||
|
||||
SET enable_seqscan = off;
|
||||
SET enable_indexscan = on;
|
||||
SELECT * FROM tbl_with_dropped_column;
|
||||
SELECT * FROM tbl_with_dropped_column ORDER BY 1, 2;
|
||||
c1 | id | c2 | c3
|
||||
----+----+----+----
|
||||
c1 | 1 | c2 |
|
||||
@ -279,8 +287,8 @@ SELECT * FROM tbl_with_dropped_column;
|
||||
SELECT * FROM view_for_dropped_column;
|
||||
c1 | id | c2 | c3
|
||||
----+----+----+----
|
||||
c1 | 1 | c2 |
|
||||
c1 | 2 | c2 |
|
||||
c1 | 1 | c2 |
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM tbl_with_dropped_toast;
|
||||
@ -306,6 +314,11 @@ ORDER BY 1;
|
||||
tbl_with_toast | {autovacuum_vacuum_scale_factor=30,autovacuum_vacuum_threshold=300}
|
||||
toast_table | {autovacuum_vacuum_scale_factor=40,autovacuum_vacuum_threshold=400}
|
||||
(2 rows)
|
||||
SELECT pg_relation_size(reltoastrelid) = 0 as check_toast_rel_size FROM pg_class WHERE relname = 'tbl_with_mod_column_storage';
|
||||
check_toast_rel_size
|
||||
----------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
--
|
||||
-- check broken links or orphan toast relations
|
||||
|
Reference in New Issue
Block a user