Re: REPACK (CONCURRENTLY) can't complete after ~105M concurrent updates/deletes

From: Alvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, shihao zhong <zhong950419(at)gmail(dot)com>, Radim Marek <radim(at)boringsql(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: REPACK (CONCURRENTLY) can't complete after ~105M concurrent updates/deletes
Date: 2026-10-07 16:18:09
Message-ID: asZumj2UTMX6dY-8@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-Oct-07, Nathan Bossart wrote:

> We talked about this one in today's RMT meeting.
>
> Processing of these concurrent changes requires a fixed small amount of
> memory for each tuple concurrently updated or deleted, not limited by
> maintenance_work_mem; if more than about 104 million rows are
> concurrently updated or deleted during the execution of REPACK, the
> command fails.
>
> This seems like a rather low limit that will definitely affect folks in the
> field. The upthread discussion indicates that the "make REPACK
> (CONCURRENTLY) MVCC-safe" work should fix this, but could there be an
> incremental improvement that alleviates this limitation in the meantime?

The limit is caused by the dynahash used in combocid.c to store the CID
mappings. An "easy" fix for this might be to mark that allocation as
using palloc_huge() somehow. I haven't actually tried that, but I
suspect it's not without its risks. (Since I didn't test it, I don't
know either if there are any other limits beyond that one.)

I'm not really sure that 105 million tuples modified concurrently during
repack is really all that small a limitation. I mean, it's not
**huge**, but it's not tiny either. If you update 1000 tuples per
second while REPACK runs, you'd need a REPACK run that takes 28 hours to
reach the limit. I guess it's definitely not impossible to hit it, if
your workload is insane enough.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-10-07 16:24:29 Re: Adding init-po and update-po targets to the meson build system
Previous Message Tom Lane 2026-10-07 16:13:18 Re: Deprecation warnings on Rocky 10.2 with current dev branch