REINDEXDB(1)

โœจ REINDEXDB(1) โœจ

okay bestie, gather round, because we're talking about reindexdb from the PostgreSQL 18.6 docs and honestly? she's a whole vibe. this is the manual page for her, but make it a group chat. let's go ๐Ÿ’…


๐ŸŽ€ NAME ๐ŸŽ€

reindexdb โ€” reindex a PostgreSQL database. that's it, that's the girl. โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

reindexdb [connection-option...] [option...] [ -S | --schema schema ]...
          [ -t | --table table ]...  [ -i | --index index ]...
          [ -s | --system ]  [dbname | -a | --all]

like, look at her. so many little switches. so much main character energy. ๐Ÿซถ


๐Ÿ’– DESCRIPTION ๐Ÿ’–

reindexdb is a utility for rebuilding indexes in a PostgreSQL database. no cap, that's literally her entire job description and she does it beautifully.

she's also a wrapper around the SQL command REINDEX. and here's the tea: there is no effective difference between reindexing databases via this utility and via other methods for accessing the server. same result, different entrance. periodt. ๐Ÿ’…


๐ŸŒธ OPTIONS ๐ŸŒธ

reindexdb accepts the following command-line arguments, and bestie, we're going through ALL of them:

  • -a, --all โ€” Reindex all databases. all of them. the whole squad. ๐Ÿ”ฅ
  • --concurrently โ€” Use the CONCURRENTLY option. See REINDEX(7), where all the caveats of this option are explained in detail. ๐Ÿ‘€ (yes, there are caveats, go read them, i'm not playing)
  • [-d] dbname, [--dbname=]dbname โ€” Specifies the name of the database to be reindexed, when -a/--all is not used. If this is not specified, the database name is read from the environment variable PGDATABASE. If that is not set, the user name specified for the connection is used. The dbname can be a connection string. If so, connection string parameters will override any conflicting command line options. (she's flexible like that ๐Ÿ’โ€โ™€๏ธ)
  • -e, --echo โ€” Echo the commands that reindexdb generates and sends to the server. so you can see exactly what she's saying behind your back. transparent queen. โœจ
  • -i index, --index=index โ€” Recreate index only. Multiple indexes can be recreated by writing multiple -i switches. stack 'em, babes. ๐ŸŽ€
  • -j njobs, --jobs=njobs โ€” Execute the reindex commands in parallel by running njobs commands simultaneously. This option may reduce the processing time but it also increases the load on the database server. (trade-offs, we love a trade-off)
    • reindexdb will open njobs connections to the database, so make sure your max_connections setting is high enough to accommodate all connections. fr fr, check your max_connections.
Note that this option is incompatible with the --system option. they do NOT get along. ๐Ÿ’€
  • -q, --quiet โ€” Do not display progress messages. silent but deadly. ๐Ÿ™ˆ
  • -s, --system โ€” Reindex database's system catalogs only. just the system catalogs, nothing else, she's being selective. ๐Ÿ’œ
  • -S schema, --schema=schema โ€” Reindex schema only. Multiple schemas can be reindexed by writing multiple -S switches. more switches, more schemas. ๐ŸŒˆ
  • -t table, --table=table โ€” Reindex table only. Multiple tables can be reindexed by writing multiple -t switches. yes, again, spam the flag. ๐Ÿ’–
  • --tablespace=tablespace โ€” Specifies the tablespace where indexes are rebuilt. (This name is processed as a double-quoted identifier.) note the double-quoted identifier thing, it matters!
  • -v, --verbose โ€” Print detailed information during processing. she's telling you EVERYTHING. ๐Ÿ—ฃ๏ธ
  • -V, --version โ€” Print the reindexdb version and exit. bye bestie ๐Ÿ‘‹
  • -?, --help โ€” Show help about reindexdb command line arguments, and exit. the classic. โœจ

๐Ÿ”Œ Connection Parameters ๐Ÿ”Œ

reindexdb also accepts the following command-line arguments for connection parameters:

  • -h host, --host=host โ€” Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. slash = socket directory, iykyk. ๐Ÿฆ‹
  • -p port, --port=port โ€” Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.
  • -U username, --username=username โ€” User name to connect as. who are you today? ๐Ÿ‘‘
  • -w, --no-password โ€” Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. (automation queen, just don't forget the .pgpass ๐Ÿ’€)
  • -W, --password โ€” Force reindexdb to prompt for a password before connecting to a database.
    • This option is never essential, since reindexdb will automatically prompt for a password if the server demands password authentication. However, reindexdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. saving that extra attempt? iconic. ๐ŸŽ€
  • --maintenance-db=dbname โ€” When the -a/--all is used, connect to this database to gather the list of databases to reindex. If not specified, the postgres database will be used, or if that does not exist, template1 will be used. This can be a connection string. If so, connection string parameters will override any conflicting command line options. Also, connection string parameters other than the database name itself will be re-used when connecting to other databases. (she recycles, we stan an eco-friendly queen ๐ŸŒธ)

๐ŸŒฟ ENVIRONMENT ๐ŸŒฟ

  • PGDATABASE
  • PGHOST
  • PGPORT
  • PGUSER

these four are your Default connection parameters. the little squad that sets you up before you even ask. ๐Ÿ’œ

  • PG_COLOR โ€” Specifies whether to use color in diagnostic messages. Possible values are always, auto and never. (set it to always, live a little โœจ)

This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 32.15). ๐Ÿฆ‹


๐Ÿฉบ DIAGNOSTICS ๐Ÿฉบ

In case of difficulty, see REINDEX(7) and psql(1) for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the libpq front-end library will apply. no server, no reindex, that's the rule bestie. ๐Ÿ˜ญ


๐Ÿ“ EXAMPLES ๐Ÿ“

To reindex the database test:

$ reindexdb test

To reindex the table foo and the index bar in a database named abcd:

$ reindexdb --table=foo --index=bar abcd

look at her go. so clean, so efficient, so slay. ๐Ÿ”ฅ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

REINDEX(7)


and that's the whole page bestie!! ๐Ÿ’–โœจ๐ŸŽ€

this was PostgreSQL 18.6, dated 2026, and yes, that footer is the same source/version energy you'd see at the bottom of the original โ€” she's official, she's documented, she's that girl. ๐Ÿซถ๐Ÿ‘‘๐Ÿ’