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

NAME

6       reindexdb - reindex a PostgreSQL database
7

SYNOPSIS

9       reindexdb [connection-option...] [option...]
10                 [ --schema | -S schema ]...  [ --table | -t table ]...
11                 [ --index | -i index ]...  [dbname]
12
13       reindexdb [connection-option...] [option...] --all | -a
14
15       reindexdb [connection-option...] [option...] --system | -s  [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(7). 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) for further
33           information.
34
35       [-d] dbname
36       [--dbname=]dbname
37           Specifies the name of the database to be reindexed. If this is not
38           specified and -a (or --all) is not used, 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.
41
42       -e
43       --echo
44           Echo the commands that reindexdb generates and sends to the server.
45
46       -i index
47       --index=index
48           Recreate index only. Multiple indexes can be recreated by writing
49           multiple -i switches.
50
51       -q
52       --quiet
53           Do not display progress messages.
54
55       -s
56       --system
57           Reindex database's system catalogs.
58
59       -S schema
60       --schema=schema
61           Reindex schema only. Multiple schemas can be reindexed by writing
62           multiple -S switches.
63
64       -t table
65       --table=table
66           Reindex table only. Multiple tables can be reindexed by writing
67           multiple -t switches.
68
69       -v
70       --verbose
71           Print detailed information during processing.
72
73       -V
74       --version
75           Print the reindexdb version and exit.
76
77       -?
78       --help
79           Show help about reindexdb command line arguments, and exit.
80
81       reindexdb also accepts the following command-line arguments for
82       connection parameters:
83
84       -h host
85       --host=host
86           Specifies the host name of the machine on which the server is
87           running. If the value begins with a slash, it is used as the
88           directory for the Unix domain socket.
89
90       -p port
91       --port=port
92           Specifies the TCP port or local Unix domain socket file extension
93           on which the server is listening for connections.
94
95       -U username
96       --username=username
97           User name to connect as.
98
99       -w
100       --no-password
101           Never issue a password prompt. If the server requires password
102           authentication and a password is not available by other means such
103           as a .pgpass file, the connection attempt will fail. This option
104           can be useful in batch jobs and scripts where no user is present to
105           enter a password.
106
107       -W
108       --password
109           Force reindexdb to prompt for a password before connecting to a
110           database.
111
112           This option is never essential, since reindexdb will automatically
113           prompt for a password if the server demands password
114           authentication. However, reindexdb will waste a connection attempt
115           finding out that the server wants a password. In some cases it is
116           worth typing -W to avoid the extra connection attempt.
117
118       --maintenance-db=dbname
119           Specifies the name of the database to connect to discover what
120           other databases should be reindexed. If not specified, the postgres
121           database will be used, and if that does not exist, template1 will
122           be used.
123

ENVIRONMENT

125       PGDATABASE
126       PGHOST
127       PGPORT
128       PGUSER
129           Default connection parameters
130
131       PG_COLOR
132           Specifies whether to use color in diagnostics messages. Possible
133           values are always, auto, never.
134
135       This utility, like most other PostgreSQL utilities, also uses the
136       environment variables supported by libpq (see Section 33.14).
137

DIAGNOSTICS

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

NOTES

145       reindexdb might need to connect several times to the PostgreSQL server,
146       asking for a password each time. It is convenient to have a ~/.pgpass
147       file in such cases. See Section 33.15 for more information.
148

EXAMPLES

150       To reindex the database test:
151
152           $ reindexdb test
153
154       To reindex the table foo and the index bar in a database named abcd:
155
156           $ reindexdb --table=foo --index=bar abcd
157

SEE ALSO

159       REINDEX(7)
160
161
162
163PostgreSQL 12.2                      2020                         REINDEXDB(1)
Impressum