From PostgreSQL wiki
Jump to: navigation, search

Historical note as of year 2020: The pg_reorg project development was ceased and/or forked into several other projects. Archived project releases are available at The pg_repack project looks like a close descendant of pg_reorg.

Project Organization

The pg_reorg developers are slowly moving the project from its old home on Pgfoundry to github. The current stable release of pg_reorg is 1.1.7, and the bleeding edge is git master. The project mailing list is still hosted on Pgfoundry. Please report bugs on the github issue tracker.

Official documentation page: pg_reorg, though documentation is being moved to the github wiki

Why use pg_reorg?

pg_reorg is handy when you have a large table which has become bloated (see Show database bloat for a useful bloat-detection query). If you are able to hold an AccessExclusive lock on the table for an extended period, you have it easy: just use CLUSTER or VACUUM FULL. However, if your table is busy being accessed by queries which can't wait hours while a CLUSTER/VACUUM FULL completes, you need a solution which will de-bloat your table and indexes while allowing concurrent reads and writes of the table. pg_reorg allows you to do precisely this. See also depesz's summary.