Re: Resetting snapshots during the first phase of [CREATE |RE]INDEX CONCURRENTLY

From: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Antonin Houska <ah(at)cybertec(dot)at>, Sergey Sargsyan <sergey(dot)sargsyan(dot)2001(at)gmail(dot)com>, Hannu Krosing <hannuk(at)google(dot)com>
Subject: Re: Resetting snapshots during the first phase of [CREATE |RE]INDEX CONCURRENTLY
Date: 2026-11-29 14:19:00
Message-ID: CADzfLwUHjLaGF_SnKn8rg5qYDFL9DCuz=FQcNeQH=KfdrEVNkg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

> I'm not really sure that we want need to have a setting for how
> frequently to reset the snapshot. For testing I agree that it's okay to
> make it very frequent, but otherwise I think we'd rather the user not
> have to be concerned with a setting for this. Just make it happen on a
> regular enough basis, so that the user can forget it.

Yes, it is for internal testing (especially the mode with a reset each time).
It is in group 'DEVELOPER_OPTIONS'.

> 100ms sounds a bit too frequent for my taste. But why do we need to
> measure it in wall-clock time? In the REPACK proposed patches, Antonin
> does it every 1024 pages (the value to be tuned, per the XXX comment in
> the patch). I think a page-measured operation is good enough, and maybe
> something like once every 128 MB (so every 16k pages?)

It was initially per-page, but adjusted after Mathias review [0] :

> Some pages may take much longer to process than others (e.g. TOAST
> pages are not accounted for, a huge gin pending list, ...), so I think
> a timer will make more sense.

I think the time-based option is a bit more understandable (I have no
idea how many pages it should be to cause a reset each 1 min, for
example).

> See
> https://postgr.es/m/af3oWkvS9K83UqmK@alvherre.pgsql
> wherein I proposed to add a PG_TEST_EXTRA variable that would be
> something like
> stress_concurrently=1
> which runs the test for a short time (I used 6 seconds), or
> stress_concurrently=0 to disable the test completely, or larger positive
> integers to scale the test up in duration and number of tuples.

In previous version it search for `stress` in PG_TEST_EXTRA and adjust
variables.
But yes, stress_concurrently=X feels better solution - I'll redo it
that way on next iteration.

Best regards,
Mikhail.

[0]: https://www.postgresql.org/message-id/CAEze2WhwwAB_DVAWfunO%3D_1QZu-J%2BThbpVbvdoOyycswQETFfw%40mail.gmail.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-11-29 14:39:52 Re: Add ASCII fast path to Unicode normalization functions
Previous Message Raja Sai pranav 2026-11-29 14:00:59 Re: Fix empty and whitespace-only input handling in option_parse_int()