Scenario
A DBA notices that range scans on the orders table by created_at are slow due to poor physical row locality — pages are fragmented across the heap after months of random inserts and updates. The DBA runs:
CLUSTER orders USING orders_created_at_idx;
CLUSTER rewrites the entire table in the physical <a class="sev1-termlink" href="https://thesev1database.com/glossary/pathkeys/">sort order of the chosen index. It acquires an AccessExclusiveLock on orders for the full duration of the rewrite. With 80 million rows, the operation takes 15 minutes. Every application query against orders — reads and writes — hangs for the entire window. Unlike REINDEX, there is no CLUSTER CONCURRENTLY option in any PostgreSQL version.
The production-safe alternative is the pg_repack extension, which rewrites the table without holding a long AccessExclusiveLock.