pageinspect support for SpGiST

Started by Kirill Reshke8 months ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliesbuild failedCI history

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t53064_2 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t53064_2 && git checkout t53064_2

Patchset v2 (message #2) is on t53064_2

Jump to latest
#1Kirill Reshke
reshkekirill@gmail.com

Hi hackers!

I am currently working for amcheck & pageinspect support for SpGiST indices.
Here is a patch implementing the pageinspect part.

My current design is two functions, which are

* spgist_page_opaque_info - akin to gin/gist opaque info functions.
* spgist_page_items - function that returns information about tuples
on the SpGiST page. Currently this works only for LEAF pages, Internal
pages to be supported.

Following "Desirability -> Design -> Implement -> Test -> Review ->
Commit" developing process, posting v1 patch with PoC and looking for
Desirability/Design feedback.

PFA (WIP) v1.

--
Best regards,
Kirill Reshke

Attachments:

v1-0001-Add-pageinspect-support-for-SpGiST-indexes.patchapplication/octet-stream; name=v1-0001-Add-pageinspect-support-for-SpGiST-indexes.patchDownload+446-2
#2Kirill Reshke
reshkekirill@gmail.com
In reply to: Kirill Reshke (#1)
Re: pageinspect support for SpGiST

On Sat, 10 Jan 2026 at 23:05, I wrote:

Currently this works only for LEAF pages, Internal pages to be supported.

I have added the spgist_innerpage_items function to address that.
spgist_page_items renamed to spgist_leafpage_items

PFA v2

--
Best regards,
Kirill Reshke

Attachments:

t53064_2
v2-0001-Add-pageinspect-support-for-SpGiST-indexes.patchapplication/octet-stream; name=v2-0001-Add-pageinspect-support-for-SpGiST-indexes.patchDownload+665-4
#3Andrey Borodin
amborodin@acm.org
In reply to: Kirill Reshke (#2)
Re: pageinspect support for SpGiST

On 11 Jan 2026, at 16:32, Kirill Reshke <reshkekirill@gmail.com> wrote:

PFA v2

Nice feature, it would be good to have in. Some nits:

1. File header is wrong — says "gistfuncs.c" and "GiST"
2. Traces of GiST are everywhere, in function names, in error messages, etc
3. spgist_metapage_items — wrong errdetail for magic number check ("Expected special size")
4. "values[6] = InvalidTransactionId;" more conventional would be "TransactionIdGetDatum(InvalidTransactionId)"
5. spgist_innerpage_items — has_datums used uninitialized in SPGIST_DEAD+ cases
6. spgist_innerpage_items — doesn't output prefix/node data, is it by design?
7. you use index_deform_tuple_internal() instead of spgDeformLeafTuple(), I'm not sure that's conventional also
8. "values[2] = UInt32GetDatum(leafTuple->size);" must be "values[2] = UInt16GetDatum(leafTuple->size);" according to "OUT size smallint,"?
9. "OUT blkno smallint," also raises sizing questions

Thanks for working on this!

Best regards, Andrey Borodin.