1REINDEXDB(1) PostgreSQL 12.6 Documentation REINDEXDB(1)
2
3
4
6 reindexdb - reindex a PostgreSQL database
7
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
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
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 -q
54 --quiet
55 Do not display progress messages.
56
57 -s
58 --system
59 Reindex database's system catalogs.
60
61 -S schema
62 --schema=schema
63 Reindex schema only. Multiple schemas can be reindexed by writing
64 multiple -S switches.
65
66 -t table
67 --table=table
68 Reindex table only. Multiple tables can be reindexed by writing
69 multiple -t switches.
70
71 -v
72 --verbose
73 Print detailed information during processing.
74
75 -V
76 --version
77 Print the reindexdb version and exit.
78
79 -?
80 --help
81 Show help about reindexdb command line arguments, and exit.
82
83 reindexdb also accepts the following command-line arguments for
84 connection parameters:
85
86 -h host
87 --host=host
88 Specifies the host name of the machine on which the server is
89 running. If the value begins with a slash, it is used as the
90 directory for the Unix domain socket.
91
92 -p port
93 --port=port
94 Specifies the TCP port or local Unix domain socket file extension
95 on which the server is listening for connections.
96
97 -U username
98 --username=username
99 User name to connect as.
100
101 -w
102 --no-password
103 Never issue a password prompt. If the server requires password
104 authentication and a password is not available by other means such
105 as a .pgpass file, the connection attempt will fail. This option
106 can be useful in batch jobs and scripts where no user is present to
107 enter a password.
108
109 -W
110 --password
111 Force reindexdb to prompt for a password before connecting to a
112 database.
113
114 This option is never essential, since reindexdb will automatically
115 prompt for a password if the server demands password
116 authentication. However, reindexdb will waste a connection attempt
117 finding out that the server wants a password. In some cases it is
118 worth typing -W to avoid the extra connection attempt.
119
120 --maintenance-db=dbname
121 Specifies the name of the database to connect to to discover which
122 databases should be reindexed, when -a/--all is used. If not
123 specified, the postgres database will be used, or if that does not
124 exist, template1 will be used. This can be a connection string. If
125 so, connection string parameters will override any conflicting
126 command line options. Also, connection string parameters other than
127 the database name itself will be re-used when connecting to other
128 databases.
129
131 PGDATABASE
132 PGHOST
133 PGPORT
134 PGUSER
135 Default connection parameters
136
137 PG_COLOR
138 Specifies whether to use color in diagnostic messages. Possible
139 values are always, auto and never.
140
141 This utility, like most other PostgreSQL utilities, also uses the
142 environment variables supported by libpq (see Section 33.14).
143
145 In case of difficulty, see REINDEX(7) and psql(1) for discussions of
146 potential problems and error messages. The database server must be
147 running at the targeted host. Also, any default connection settings and
148 environment variables used by the libpq front-end library will apply.
149
151 reindexdb might need to connect several times to the PostgreSQL server,
152 asking for a password each time. It is convenient to have a ~/.pgpass
153 file in such cases. See Section 33.15 for more information.
154
156 To reindex the database test:
157
158 $ reindexdb test
159
160 To reindex the table foo and the index bar in a database named abcd:
161
162 $ reindexdb --table=foo --index=bar abcd
163
165 REINDEX(7)
166
167
168
169PostgreSQL 12.6 2021 REINDEXDB(1)