Clustering a table in PostgreSQL involves physically ordering its rows according to the keys of a specified B+Tree index. Clustering is beneficial when queries frequently access ranges of values in that index, as it improves I/O performance by reducing page reads and optimizing cache locality.
However, clustering does not persist automatically. Subsequent inserts and updates follow the heap’s default space allocation policies. Clustering must be re-applied manually or scheduled periodically to maintain its benefits.
The PostgreSQL CLUSTER command requires an exclusive lock on the table, making it unsuitable for frequently updated tables in high-availability environments.