1REINDEXDB(1) PostgreSQL 11.6 Documentation REINDEXDB(1)
2
3
4
6 reindexdb - reindex a PostgreSQL database
7
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
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 [-d] dbname
32 [--dbname=]dbname
33 Specifies the name of the database to be reindexed. If this is not
34 specified and -a (or --all) is not used, the database name is read
35 from the environment variable PGDATABASE. If that is not set, the
36 user name specified for the connection is used.
37
38 -e
39 --echo
40 Echo the commands that reindexdb generates and sends to the server.
41
42 -i index
43 --index=index
44 Recreate index only. Multiple indexes can be recreated by writing
45 multiple -i switches.
46
47 -q
48 --quiet
49 Do not display progress messages.
50
51 -s
52 --system
53 Reindex database's system catalogs.
54
55 -S schema
56 --schema=schema
57 Reindex schema only. Multiple schemas can be reindexed by writing
58 multiple -S switches.
59
60 -t table
61 --table=table
62 Reindex table only. Multiple tables can be reindexed by writing
63 multiple -t switches.
64
65 -v
66 --verbose
67 Print detailed information during processing.
68
69 -V
70 --version
71 Print the reindexdb version and exit.
72
73 -?
74 --help
75 Show help about reindexdb command line arguments, and exit.
76
77 reindexdb also accepts the following command-line arguments for
78 connection parameters:
79
80 -h host
81 --host=host
82 Specifies the host name of the machine on which the server is
83 running. If the value begins with a slash, it is used as the
84 directory for the Unix domain socket.
85
86 -p port
87 --port=port
88 Specifies the TCP port or local Unix domain socket file extension
89 on which the server is listening for connections.
90
91 -U username
92 --username=username
93 User name to connect as.
94
95 -w
96 --no-password
97 Never issue a password prompt. If the server requires password
98 authentication and a password is not available by other means such
99 as a .pgpass file, the connection attempt will fail. This option
100 can be useful in batch jobs and scripts where no user is present to
101 enter a password.
102
103 -W
104 --password
105 Force reindexdb to prompt for a password before connecting to a
106 database.
107
108 This option is never essential, since reindexdb will automatically
109 prompt for a password if the server demands password
110 authentication. However, reindexdb will waste a connection attempt
111 finding out that the server wants a password. In some cases it is
112 worth typing -W to avoid the extra connection attempt.
113
114 --maintenance-db=dbname
115 Specifies the name of the database to connect to discover what
116 other databases should be reindexed. If not specified, the postgres
117 database will be used, and if that does not exist, template1 will
118 be used.
119
121 PGDATABASE
122 PGHOST
123 PGPORT
124 PGUSER
125 Default connection parameters
126
127 This utility, like most other PostgreSQL utilities, also uses the
128 environment variables supported by libpq (see Section 34.14).
129
131 In case of difficulty, see REINDEX(7) and psql(1) for discussions of
132 potential problems and error messages. The database server must be
133 running at the targeted host. Also, any default connection settings and
134 environment variables used by the libpq front-end library will apply.
135
137 reindexdb might need to connect several times to the PostgreSQL server,
138 asking for a password each time. It is convenient to have a ~/.pgpass
139 file in such cases. See Section 34.15 for more information.
140
142 To reindex the database test:
143
144 $ reindexdb test
145
146 To reindex the table foo and the index bar in a database named abcd:
147
148 $ reindexdb --table=foo --index=bar abcd
149
151 REINDEX(7)
152
153
154
155PostgreSQL 11.6 2019 REINDEXDB(1)