mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Delete empty pages during GiST VACUUM.
To do this, we scan GiST two times. In the first pass we make note of empty leaf pages and internal pages. At second pass we scan through internal pages, looking for downlinks to the empty pages. Deleting internal pages is still not supported, like in nbtree, the last child of an internal page is never deleted. That means that if you have a workload where new keys are always inserted to different area than where old keys are removed, the index will still grow without bound. But the rate of growth will be an order of magnitude slower than before. Author: Andrey Borodin Discussion: https://www.postgresql.org/message-id/B1E4DF12-6CD3-4706-BDBD-BF3283328F60@yandex-team.ru
This commit is contained in:
@ -27,10 +27,8 @@ insert into gist_point_tbl (id, p)
|
||||
select g+100000, point(g*10+1, g*10+1) from generate_series(1, 10000) g;
|
||||
-- To test vacuum, delete some entries from all over the index.
|
||||
delete from gist_point_tbl where id % 2 = 1;
|
||||
-- And also delete some concentration of values. (GiST doesn't currently
|
||||
-- attempt to delete pages even when they become empty, but if it did, this
|
||||
-- would exercise it)
|
||||
delete from gist_point_tbl where id < 10000;
|
||||
-- And also delete some concentration of values.
|
||||
delete from gist_point_tbl where id > 5000;
|
||||
vacuum analyze gist_point_tbl;
|
||||
-- rebuild the index with a different fillfactor
|
||||
alter index gist_pointidx SET (fillfactor = 40);
|
||||
|
@ -28,10 +28,8 @@ select g+100000, point(g*10+1, g*10+1) from generate_series(1, 10000) g;
|
||||
-- To test vacuum, delete some entries from all over the index.
|
||||
delete from gist_point_tbl where id % 2 = 1;
|
||||
|
||||
-- And also delete some concentration of values. (GiST doesn't currently
|
||||
-- attempt to delete pages even when they become empty, but if it did, this
|
||||
-- would exercise it)
|
||||
delete from gist_point_tbl where id < 10000;
|
||||
-- And also delete some concentration of values.
|
||||
delete from gist_point_tbl where id > 5000;
|
||||
|
||||
vacuum analyze gist_point_tbl;
|
||||
|
||||
|
Reference in New Issue
Block a user