Skip to content
schmiddy edited this page Oct 15, 2012 · 3 revisions

Name

pg_reorg -- Reorganize tables in a PostgreSQL database without holding locks.


Synopsis

pg_reorg [OPTIONS]

The following options can be specified in OPTIONS. See also "Options" for details.

Reorg Options

  • -o [--order-by] columns [,...]
  • -n [--no-order]
  • -t [--table] table
  • -T [--wait-timeout] seconds
  • -Z [--no-analyze]

Connection Options

  • -a, --all : reorganize all databases
  • -d, --dbname=DBNAME : database to connect
  • -h, --host=HOSTNAME : database server host or socket directory
  • -p, --port=PORT : database server port
  • -U, --username=USERNAME : user name to connect as
  • -w, --no-password : never prompt for password
  • -W, --password : force password prompt

Generic Options

  • -e, --echo : echo queries
  • -E, --elevel=LEVEL : set output message level
  • --help : show the help, then exit
  • --version : output version information, then exit

Description

pg_reorg is an utility program to reorganize tables in PostgreSQL databases. Unlike clusterdb, it doesn't block concurrent DML (i.e. SELECTs or UPDATEs) of the table while it is being compacted. You can choose one of the following methods to reorganize.

  • Online CLUSTER (ordered by cluster index)
  • Ordered by specified columns
  • Online VACUUM FULL (packing rows only)

NOTICE:

  • Only superusers can use the utility.
  • Target table must have PRIMARY KEY.

Examples

The following invocation performs an online CLUSTER of all tables in the test database.

$ pg_reorg test

The following invocation performs an online VACUUM FULL of table foo in the test database.

$ pg_reorg --no-order --table foo -d test

Options

pg_reorg has the following command line options:

Reorg Options

Clone this wiki locally