-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Labels
Description
Hi!
When running pg_repack on a table ~1TB with --order-by, the process reaches the APPLY stage. When the row count drops below --switch-threshold, pg_repack should acquire an exclusive lock for the final table swap, but fails to do so. The row count then increases again, causing an infinite loop.
The problem occurred with default --switch-threshold settings. We tried increasing --switch-threshold to 4900 and --apply-count to 5000, but the issue persists.
Manually acquiring an exclusive lock on the table for 0.5 seconds allows pg_repack to complete successfully.
pg_repack version:
pg_repack | 1.5.2 | public | Reorganize tables in PostgreSQL databases with minimal locks