Welcome to the pg_reorg Project Home Page

This project provides two tools for PostgreSQL; pg_reorg and pg_batch.

pg_reorg can re-organize tables on a postgres database without any locks so that you can retrieve or update rows in tables being reorganized. The module is developed to be a better alternative of CLUSTER and VACUUM FULL.

pg_batch is a SQL job executor program for PostgreSQL. It generates job list from an external SQL script file, and execute the jobs in serial or parallel. It can be used as "a better vacuumdb" with the attached script to run VACUUM.

The pg_reorg project is a PostgreSQL Community project that is a part of the pgFoundry.

The pgFoundry page for the project is at http://pgfoundry.org/projects/reorg, where you can find downloads, documentation, bug reports, mailing lists, and a whole lot more.



Execution time

Here is a comparison between pg_reorg and clusterdb. Clusterdb is faster on not fragmented conditions, but pg_reorg is faster on fully fragmented conditions. Since reorganization is needed only if tables are fragmented, pg_reorg should be faster than clusterdb.

Category Item Details
Hardware CPU 2 * Xeon 5160 3.00GHz (Dual core)
Memory 2GB
Storage Ultra320 SCSI, 15000rpm (220GB)
Software OS RHEL 5.2 (64bit) 2.6.18-92.el5
DB PostgreSQL 8.3.3
pg_reorg 1.0.0
clusterdb clusterdb (PostgreSQL) 8.3.3
Data Scheme
 id bigserial PRIMARY KEY,
 seqkey timestamp NOT NULL,
 rndkey timestamp NOT NULL,
 filler char(75) NOT NULL
CREATE INDEX idx_seq ON tbl (seqkey);
CREATE INDEX idx_rnd ON tbl (rndkey);
Rows 16.5 M rows (2GB)