Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements
Mihail Nikalayeu <michail.nikolaev@gmail.com>
From: Michail Nikolaev <michail.nikolaev@gmail.com>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Andrey Borodin <amborodin86@gmail.com>,
Melanie Plageman <melanieplageman@gmail.com>
Date: 2025-01-18T14:18:00Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Revert changes to CONCURRENTLY that "sped up" Xmin advance
- e28bb8851969 15.0 cited
-
VACUUM: ignore indexing operations with CONCURRENTLY
- d9d076222f5b 14.0 cited
-
Avoid spurious waits in concurrent indexing
- c98763bf51bf 14.0 cited
Attachments
- v12-0005-Allow-snapshot-resets-during-parallel-concurrent.patch (application/octet-stream) patch v12-0005
- v12-0004-Allow-advancing-xmin-during-non-unique-non-paral.patch (application/octet-stream) patch v12-0004
- v12-0003-Add-stress-tests-for-concurrent-index-operations.patch (application/octet-stream) patch v12-0003
- v12-0002-This-is-https-commitfest.postgresql.org-50-5160-.patch (application/octet-stream) patch v12-0002
- v12-0001-ExecInitAgg-update-aggstate-numaggs-and-numtrans.patch (application/octet-stream) patch v12-0001
- v12-0007-Add-STIR-Short-Term-Index-Replacement-access-met.patch (application/octet-stream) patch v12-0007
- v12-0006-Allow-snapshot-resets-in-concurrent-unique-index.patch (application/octet-stream) patch v12-0006
- v12-0008-Improve-CREATE-REINDEX-INDEX-CONCURRENTLY-using-.patch (application/octet-stream) patch v12-0008
- v12-0009-Concurrently-built-index-validation-uses-fresh-s.patch (application/octet-stream) patch v12-0009
- v12-0010-Remove-PROC_IN_SAFE_IC-optimization.patch (application/octet-stream) patch v12-0010
- v12-0012-Updates-index-insert-and-value-computation-logic.patch (application/octet-stream) patch v12-0012
- v12-0011-Add-proper-handling-of-auxiliary-indexes-during-.patch (application/octet-stream) patch v12-0011
Hello, everyone! This is an updated version, contains some optimization into STIR index access method, related to the fact it is never used with WAL. > The locking in stirinsert can probably be improved significantly if > we use things like atomic operations on STIR pages. We'd need an > exclusive lock only for page initialization, while share locks are > enough if the page's data is modified without WAL. That should improve > concurrent insert performance significantly, as it would further > reduce the length of the exclusively locked hot path. Mathias, you were proposed to use just shared locking to writes, but how is it possible if it is required to mark page as dirty, and it requires exclusive lock? > It occurs because the first phase is slow, and many tuples need to be inserted during the validation phase. > For each tuple, heapam_index_fetch_tuple is called, even for those on the same page. > It might be possible to implement a batched version of heapam_index_fetch_tuple to handle multiple tuples on the same page and mitigate this issue. It was a wrong assumption. It looks like it is happening because of prefetching. I'll try to add it in the validation phase. Best regards, Mikhail.