1REINDEXDB(1)             PostgreSQL 15.4 Documentation            REINDEXDB(1)
2
3
4

NAME

6       reindexdb - reindex a PostgreSQL database
7

SYNOPSIS

9       reindexdb [connection-option...] [option...]
10                 [ -S | --schema schema ]...  [ -t | --table table ]...
11                 [ -i | --index index ]...  [dbname]
12
13       reindexdb [connection-option...] [option...] -a | --all
14
15       reindexdb [connection-option...] [option...] -s | --system  [dbname]
16

DESCRIPTION

18       reindexdb is a utility for rebuilding indexes in a PostgreSQL database.
19
20       reindexdb is a wrapper around the SQL command REINDEX. There is no
21       effective difference between reindexing databases via this utility and
22       via other methods for accessing the server.
23

OPTIONS

25       reindexdb accepts the following command-line arguments:
26
27       -a
28       --all
29           Reindex all databases.
30
31       --concurrently
32           Use the CONCURRENTLY option. See REINDEX(7), where all the caveats
33           of this option are explained in detail.
34
35       [-d] dbname
36       [--dbname=]dbname
37           Specifies the name of the database to be reindexed, when -a/--all
38           is not used. If this is not specified, the database name is read
39           from the environment variable PGDATABASE. If that is not set, the
40           user name specified for the connection is used. The dbname can be a
41           connection string. If so, connection string parameters will
42           override any conflicting command line options.
43
44       -e
45       --echo
46           Echo the commands that reindexdb generates and sends to the server.
47
48       -i index
49       --index=index
50           Recreate index only. Multiple indexes can be recreated by writing
51           multiple -i switches.
52
53       -j njobs
54       --jobs=njobs
55           Execute the reindex commands in parallel by running njobs commands
56           simultaneously. This option may reduce the processing time but it
57           also increases the load on the database server.
58
59           reindexdb will open njobs connections to the database, so make sure
60           your max_connections setting is high enough to accommodate all
61           connections.
62
63           Note that this option is incompatible with the --index and --system
64           options.
65
66       -q
67       --quiet
68           Do not display progress messages.
69
70       -s
71       --system
72           Reindex database's system catalogs only.
73
74       -S schema
75       --schema=schema
76           Reindex schema only. Multiple schemas can be reindexed by writing
77           multiple -S switches.
78
79       -t table
80       --table=table
81           Reindex table only. Multiple tables can be reindexed by writing
82           multiple -t switches.
83
84       --tablespace=tablespace
85           Specifies the tablespace where indexes are rebuilt. (This name is
86           processed as a double-quoted identifier.)
87
88       -v
89       --verbose
90           Print detailed information during processing.
91
92       -V
93       --version
94           Print the reindexdb version and exit.
95
96       -?
97       --help
98           Show help about reindexdb command line arguments, and exit.
99
100       reindexdb also accepts the following command-line arguments for
101       connection parameters:
102
103       -h host
104       --host=host
105           Specifies the host name of the machine on which the server is
106           running. If the value begins with a slash, it is used as the
107           directory for the Unix domain socket.
108
109       -p port
110       --port=port
111           Specifies the TCP port or local Unix domain socket file extension
112           on which the server is listening for connections.
113
114       -U username
115       --username=username
116           User name to connect as.
117
118       -w
119       --no-password
120           Never issue a password prompt. If the server requires password
121           authentication and a password is not available by other means such
122           as a .pgpass file, the connection attempt will fail. This option
123           can be useful in batch jobs and scripts where no user is present to
124           enter a password.
125
126       -W
127       --password
128           Force reindexdb to prompt for a password before connecting to a
129           database.
130
131           This option is never essential, since reindexdb will automatically
132           prompt for a password if the server demands password
133           authentication. However, reindexdb will waste a connection attempt
134           finding out that the server wants a password. In some cases it is
135           worth typing -W to avoid the extra connection attempt.
136
137       --maintenance-db=dbname
138           Specifies the name of the database to connect to to discover which
139           databases should be reindexed, when -a/--all is used. If not
140           specified, the postgres database will be used, or if that does not
141           exist, template1 will be used. This can be a connection string. If
142           so, connection string parameters will override any conflicting
143           command line options. Also, connection string parameters other than
144           the database name itself will be re-used when connecting to other
145           databases.
146

ENVIRONMENT

148       PGDATABASE
149       PGHOST
150       PGPORT
151       PGUSER
152           Default connection parameters
153
154       PG_COLOR
155           Specifies whether to use color in diagnostic messages. Possible
156           values are always, auto and never.
157
158       This utility, like most other PostgreSQL utilities, also uses the
159       environment variables supported by libpq (see Section 34.15).
160

DIAGNOSTICS

162       In case of difficulty, see REINDEX(7) and psql(1) for discussions of
163       potential problems and error messages. The database server must be
164       running at the targeted host. Also, any default connection settings and
165       environment variables used by the libpq front-end library will apply.
166

NOTES

168       reindexdb might need to connect several times to the PostgreSQL server,
169       asking for a password each time. It is convenient to have a ~/.pgpass
170       file in such cases. See Section 34.16 for more information.
171

EXAMPLES

173       To reindex the database test:
174
175           $ reindexdb test
176
177       To reindex the table foo and the index bar in a database named abcd:
178
179           $ reindexdb --table=foo --index=bar abcd
180

SEE ALSO

182       REINDEX(7)
183
184
185
186PostgreSQL 15.4                      2023                         REINDEXDB(1)
Impressum