| From: | Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com> |
|---|---|
| To: | Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
| Cc: | Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Antonin Houska <ah(at)cybertec(dot)at>, Hannu Krosing <hannuk(at)google(dot)com>, Sergey Sargsyan <sergey(dot)sargsyan(dot)2001(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Andrey Borodin <amborodin86(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com> |
| Subject: | Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements |
| Date: | 2026-08-06 10:08:01 |
| Message-ID: | CADzfLwW=q71fw0hye9K3vBnS7RR50rTcCM91ZbWkiKeU+5s4_g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello, Matthias!
Thanks for the review!
> "git am" correctly raised some whitespace warnings around spaces vs tabs:
Fixed. I have also run pgindent over stir.c/stir.h
and added the STIR typedefs to typedefs.list.
> > + Assert(!RelationNeedsWAL(index));
>
> Why is this so frequently asserted? STIR can be created on any
> relation, and AFAIK indexes should have the same persistence settings
> as their tables (I suspect assertions could fail if this isn't
> maintained).
STIR indexes are intentionally always created unlogged, regardless of
the persistence of the table - an auxiliary index has no reason to
survive a crash. Added some comments about it, including the relpersistence
parameter of index_create.
> Shouldn't this assert() that there are no operators in the opclass/opfamily?
Yes, made that error.
> This doesn't WAL-log the data in INIT_FORKNUM, and I think that's
> still required for non-temp relations without WAL (i.e. unlogged
> relations, such as the STIR index).
Nice catch!
Fixed by writing the metapage through bulk-write (like btbuildempty
does), which WAL-logs and syncs init-fork pages cregardless of
relation persistence. Also added a TAP test for that.
> I think it'd be better if the insertions were distributed across a few
> pages a few pages have been filled, to avoid this source of lock
> contention
Yes, I'll revisit it later in v38. Also, rd_amcache may be helpfull here.
For now I haven't seen it as a hot spot in any benchmarks I was running.
> Let's put the new boolean with the other booleans, so between
> estimated_count and message_level, that'll save 8 bytes of padding.
Done.
> You add a new RELOPT_KIND_STIR variant to enum relopt_kind, but it's
> never used. Do we need the new variant?
Removed, some stale artifact.
> This should be 0; we can't allow any operators to be registered to
> this AM; they don't make sense when we don't carry data.
Done.
> I don't see it being used in any non-false manner in this patch; maybe
> postpone this field to 0003?
Moved to 0004 - the first patch that actually uses it.
> And put it ahead of ii_ParallelWorkers,
> it has padding bytes available that otherwise would go unused.
Done.
> I agree with this diff, but you'll have to add an explanation in the
> comment above the query, indicating why stir_ops should be allowed to
> not have matching operators in its opclasses.
Done.
> I think the `datum` case could benefit from defining different
> functions for byval, sized-byref, and variable-byref types, because
> it'll reduce the compiled size (and branching) of the call
Done, but perhaps too much in an AI-driven way; I will revalidate later.
> 0004 doesn't apply anymore, and I'll be out until after the weekend,
> so further reviews will arrive not until next week.
Rebased everything.
0007 probably shares some complaints about snapshot resetting as in
your previous review - I'll address those complaints first in another patch.
Best regards,
Mikhail.
| Attachment | Content-Type | Size |
|---|---|---|
| v37-0003-Add-Datum-storage-support-to-tuplestore-Extend-t.patch | application/x-patch | 23.0 KB |
| v37-0004-Use-auxiliary-indexes-for-concurrent-index-opera.patch | application/x-patch | 104.1 KB |
| v37-0007-Refresh-snapshot-periodically-during-index-valid.patch | application/x-patch | 27.1 KB |
| v37-0005-Track-and-drop-auxiliary-indexes-in-DROP-REINDEX.patch | application/x-patch | 37.8 KB |
| v37-0006-Optimize-auxiliary-index-handling.patch | application/x-patch | 3.0 KB |
| v37-0002-Add-STIR-access-method-and-flags-related-to-auxi.patch | application/x-patch | 35.6 KB |
| v37-0001-Add-stress-tests-for-concurrent-index-builds.patch | application/x-patch | 12.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shlok Kyal | 2026-08-06 10:20:09 | Re: Re-read subscription state after lock in AlterSubscription |
| Previous Message | solai v | 2026-08-06 09:40:08 | Re: Cleaning up PREPARE query strings? |