Re: Yet another fast GiST build
x4mmm@yandex-team.ru
From: Andrey Borodin <x4mmm@yandex-team.ru>
To: emre@hasegeli.com
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Peter Geoghegan <pg@bowt.ie>, Tom Lane <tgl@sss.pgh.pa.us>, Justin Pryzby <pryzby@telsasoft.com>, Darafei Komяpa Praliaskouski <me@komzpa.net>, Pavel Borisov <pashkin.elfe@gmail.com>, Thomas Munro <thomas.munro@gmail.com>, Michael Paquier <michael@paquier.xyz>, Alexander Korotkov <a.korotkov@postgrespro.ru>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Ibrar Ahmed <ibrar.ahmad@gmail.com>
Date: 2021-12-16T09:18:52Z
Lists: pgsql-hackers
Attachments
- v4-0001-Add-sortsupport-for-gist_btree-opclasses-for-fast.patch (application/octet-stream) patch v4-0001
- v4-0002-Remove-DEBUG1-verification-of-the-fact-that-index.patch (text/x-diff) patch v4-0002
- v4-0003-Fix-varlen-keys-sorting.patch (text/x-diff) patch v4-0003
- v4-0004-Review-notes-from-Emre-Hasegeli.patch (text/x-diff) patch v4-0004
Hi Emre! Thank you for the review. > I tried reviewing the remaining patches. It seems to work correctly, > and passes the tests on my laptop. > >> In this pattern I flipped PointerGetDatum(a) to PointerGetDatum(ra.lower), because it seems to me correct. I've followed rule of thumb: every sort function must extract and use "lower" somehow. Though I suspect numeric a bit. Is it regular varlena? > > As far as I understand, we cannot use the sortsupport functions from > the btree operator classes because the btree_gist extension handles > things differently. This is unfortunate and a source of bugs [1], but > we cannot do anything about it. > > Given that the lower and upper datums must be the same for the leaf > nodes, it makes sense to me to compare one of them. > > Using numeric_cmp() for numeric in line with using bttextcmp() for text. OK. >> + /* >> + * Numeric has abbreviation routines in numeric.c, but we don't try to use >> + * them here. Maybe later. >> + */ > > This is also true for text. Perhaps we should also add a comment there. Done. > >> PFA patchset with v6 intact + two fixes of discovered issues. > >> + /* Use byteacmp(), like gbt_bitcmp() does */ > > We can improve this comment by incorporating Heikki's previous email: > >> Ok, I think I understand that now. In btree_gist, the *_cmp() function >> operates on non-leaf values, and *_lt(), *_gt() et al operate on leaf >> values. For all other datatypes, the leaf and non-leaf representation is >> the same, but for bit/varbit, the non-leaf representation is different. >> The leaf representation is VarBit, and non-leaf is just the bits without >> the 'bit_len' field. That's why it is indeed correct for gbt_bitcmp() to >> just use byteacmp(), whereas gbt_bitlt() et al compares the 'bit_len' >> field separately. That's subtle, and 100% uncommented. > Done. > I think patch number 3 should be squashed to patch number 1. All patches in the patchset expected to be squashed into 1 during commit. > > I couldn't understand patch number 2 "Remove DEBUG1 verification". It > seems like something rather useful. If failed on buildfarm on some nodes. There were somewhat extroneous error messages. Currently Step 1 and 2 are separete to ensure that opclasses are used correctly. Thanks! Best regards, Andrey Borodin.
Commits
-
Add sortsupport for gist_btree opclasses, for faster index builds.
- 9f984ba6d23d 14.0 landed
-
pageinspect: Fix relcache leak in gist_page_items().
- 04eb75e783ba 14.0 landed
-
Fix test failure with wal_level=minimal.
- 5abca4b1cd71 14.0 landed
-
Enhance nbtree index tuple deletion.
- d168b666823b 14.0 cited
-
Fix portability issues in the new gist pageinspect test.
- 6ecaaf810b8b 14.0 landed
-
Add functions to 'pageinspect' to inspect GiST indexes.
- 756ab29124d7 14.0 landed
-
Fix missing validation for the new GiST sortsupport functions.
- 6f0bc5e1daf0 14.0 landed
-
Fix compilation warning in xlog.c
- 0a3c864c3275 14.0 cited
-
Set right-links during sorted GiST index build.
- 265ea567852a 14.0 landed
-
Fix checksum calculation in the new sorting GiST build.
- c47a240fe6db 14.0 landed
-
Add support for building GiST index by sorting.
- 16fa9b2b30a3 14.0 landed