OS Manuals

/usr/bin/pg_repack

PostgreSQL extension and client for repacking tables with minimal locks

From pg_repack-18 1.5.3-r5 (enterprise-packages), captured 2026-11-08 by running pg_repack --help (exit 0). permalink

Also provided by 2 other package versions
pg_repack re-organizes a PostgreSQL database.

Usage:
  pg_repack [OPTION]... [DBNAME]
Options:
  -a, --all                          repack all databases
  -t, --table=TABLE                  repack specific table only
  -I, --parent-table=TABLE           repack specific parent table and its inheritors
  -c, --schema=SCHEMA                repack tables in specific schema only
  -s, --tablespace=TBLSPC            move repacked tables to a new tablespace
  -S, --moveidx                      move repacked indexes to TBLSPC too
  -o, --order-by=COLUMNS             order by columns instead of cluster keys
  -n, --no-order                     do vacuum full instead of cluster
  -N, --dry-run                      print what would have been repacked
  -j, --jobs=NUM                     Use this many parallel jobs for each table
  -i, --index=INDEX                  move only the specified index
  -x, --only-indexes                 move only indexes of the specified table
  -T, --wait-timeout=SECS            timeout to cancel other backends on conflict
  -D, --no-kill-backend              don't kill other backends when timed out
  -Z, --no-analyze                   don't analyze at end
  -k, --no-superuser-check           skip superuser checks in client
  -C, --exclude-extension            don't repack tables which belong to specific extension
      --no-error-on-invalid-index    repack even though invalid index is found
      --error-on-invalid-index       don't repack when invalid index is found, deprecated, as this is the default behavior now
      --apply-count                  number of tuples to apply in one transaction during replay
      --switch-threshold             switch tables when that many tuples are left to catchup

Connection options:
  -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 this help, then exit
  --version                 output version information, then exit

Read the website for details: <https://reorg.github.io/pg_repack/>.
Report bugs to <https://github.com/reorg/pg_repack/issues>.
Options (31)
OptionDescriptionSource
-a, --allrepack all databaseshelp
-t, --table TABLErepack specific table onlyhelp
-I, --parent-table TABLErepack specific parent table and its inheritorshelp
-c, --schema SCHEMArepack tables in specific schema onlyhelp
-s, --tablespace TBLSPCmove repacked tables to a new tablespacehelp
-S, --moveidxmove repacked indexes to TBLSPC toohelp
-o, --order-by COLUMNSorder by columns instead of cluster keyshelp
-n, --no-orderdo vacuum full instead of clusterhelp
-N, --dry-runprint what would have been repackedhelp
-j, --jobs NUMUse this many parallel jobs for each tablehelp
-i, --index INDEXmove only the specified indexhelp
-x, --only-indexesmove only indexes of the specified tablehelp
-T, --wait-timeout SECStimeout to cancel other backends on conflicthelp
-D, --no-kill-backenddon't kill other backends when timed outhelp
-Z, --no-analyzedon't analyze at endhelp
-k, --no-superuser-checkskip superuser checks in clienthelp
-C, --exclude-extensiondon't repack tables which belong to specific extensionhelp
--no-error-on-invalid-indexrepack even though invalid index is foundhelp
--error-on-invalid-indexdon't repack when invalid index is found, deprecated, as this is the default behavior nowhelp
--apply-countnumber of tuples to apply in one transaction during replayhelp
--switch-thresholdswitch tables when that many tuples are left to catchuphelp
-d, --dbname DBNAMEdatabase to connecthelp
-h, --host HOSTNAMEdatabase server host or socket directoryhelp
-p, --port PORTdatabase server porthelp
-U, --username USERNAMEuser name to connect ashelp
-w, --no-passwordnever prompt for passwordhelp
-W, --passwordforce password prompthelp
-e, --echoecho querieshelp
-E, --elevel LEVELset output message levelhelp
--helpshow this help, then exithelp
--versionoutput version information, then exithelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.