Make index_concurrently_create_copy more general
Álvaro Herrera <alvherre@kurilemu.de>
Make index_concurrently_create_copy more general Also rename it to index_create_copy. Add a 'boolean concurrent' option, and make it work for both cases: in concurrent mode, just create the catalog entries; caller is responsible for the actual building later. In non-concurrent mode, the index is built right away. This allows it to be reused for other purposes -- specifically, for concurrent REPACK. (With the CONCURRENTLY option, REPACK cannot simply swap the heap file and rebuild its indexes. Instead, it needs to build a separate set of indexes, including their system catalog entries, *before* the actual swap, to reduce the time AccessExclusiveLock needs to be held for. This approach is different from what CREATE INDEX CONCURRENTLY does.) Per a suggestion from Mihail Nikalayeu. Author: Antonin Houska <ah@cybertec.at> Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/41104.1754922120@localhost
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/catalog/index.c | modified | +28 −13 |
| src/backend/commands/indexcmds.c | modified | +5 −4 |
| src/include/catalog/index.h | modified | +3 −4 |
Discussion
- Adding REPACK [concurrently] 409 messages · 2025-07-26 → 2026-07-01