Re: GiST VACUUM
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: Michael Paquier <michael@paquier.xyz>, Thomas Munro <thomas.munro@enterprisedb.com>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, Костя Кузнецов <chapaev28@ya.ru>
Date: 2019-03-22T10:28:53Z
Lists: pgsql-hackers
On 22/03/2019 10:00, Andrey Borodin wrote: >> 22 марта 2019 г., в 1:04, Heikki Linnakangas <hlinnaka@iki.fi> >> написал(а): >> >> PS. for Gist, we could almost use the LSN / NSN mechanism to detect >> the case that a deleted page is reused: Add a new field to the GiST >> page header, to store a new "deleteNSN" field. When a page is >> deleted, the deleted page's deleteNSN is set to the LSN of the >> deletion record. When the page is reused, the deleteNSN field is >> kept unchanged. When you follow a downlink during search, if you >> see that the page's deleteNSN > parent's LSN, you know that it was >> concurrently deleted and recycled, and should be ignored. That >> would allow reusing deleted pages immediately. Unfortunately that >> would require adding a new field to the gist page header/footer, >> which requires upgrade work :-(. Maybe one day, we'll bite the >> bullet. Something to keep in mind, if we have to change the page >> format anyway, for some reason. > > Yeah, the same day we will get rid of invalid tuples. I can make a > patch for v13. Actually, I have a lot of patches that I want in GiST > in v13. Or v14. Cool! Here's my wishlist: * That deleteNSN thing * Add a metapage to blk #0. * Add a "level"-field to page header. * Currently, a search needs to scan all items on a page. If the keys are small, that can be pretty slow. Divide each page further into e.g. 4 sub-pages, with a "bounding box" key for each sub-page, to speed up search. - Heikki
Commits
-
Use full 64-bit XID for checking if a deleted GiST page is old enough.
- fb5344c969af 12.0 landed
- 6655a7299d83 13.0 landed
-
Refactor checks for deleted GiST pages.
- e2e992c93145 12.0 landed
- 9eb5607e6993 13.0 landed
-
Delete empty pages during GiST VACUUM.
- 7df159a620b7 12.0 landed
-
Scan GiST indexes in physical order during VACUUM.
- fe280694d0d4 12.0 landed
-
Prevent GIN deleted pages from being reclaimed too early
- 52ac6cd2d0cd 12.0 cited