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 theCONCURRENTLYoption. SeeREINDEX(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/--allis not used. If this is not specified, the database name is read from the environment variablePGDATABASE. If that is not set, the user name specified for the connection is used. Thedbnamecan 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 thatreindexdbgenerates 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-iswitches. stack 'em, babes. ๐-j njobs,--jobs=njobsโ Execute the reindex commands in parallel by runningnjobscommands 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)reindexdbwill opennjobsconnections to the database, so make sure yourmax_connectionssetting is high enough to accommodate all connections. fr fr, check yourmax_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-Sswitches. more switches, more schemas. ๐-t table,--table=tableโ Reindex table only. Multiple tables can be reindexed by writing multiple-tswitches. 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 thereindexdbversion and exit. bye bestie ๐-?,--helpโ Show help aboutreindexdbcommand 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.pgpassfile, 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โ Forcereindexdbto prompt for a password before connecting to a database.- This option is never essential, since
reindexdbwill automatically prompt for a password if the server demands password authentication. However,reindexdbwill waste a connection attempt finding out that the server wants a password. In some cases it is worth typing-Wto avoid the extra connection attempt. saving that extra attempt? iconic. ๐
- This option is never essential, since
--maintenance-db=dbnameโ When the-a/--allis used, connect to this database to gather the list of databases to reindex. If not specified, thepostgresdatabase will be used, or if that does not exist,template1will 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 ๐ฟ
PGDATABASEPGHOSTPGPORTPGUSER
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 arealways,autoandnever. (set it toalways, 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 ๐
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. ๐ซถ๐๐
๐ฆ where this page comes from
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms