]> begriffs open source - ai-pg/blob - full-docs/src/sgml/man1/reindexdb.1
WIP: toc builder
[ai-pg] / full-docs / src / sgml / man1 / reindexdb.1
1 '\" t
2 .\"     Title: reindexdb
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "REINDEXDB" "1" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 reindexdb \- reindex a PostgreSQL database
32 .SH "SYNOPSIS"
33 .HP \w'\fBreindexdb\fR\ 'u
34 \fBreindexdb\fR [\fIconnection\-option\fR...] [\fIoption\fR...] [\ \fB\-S\fR\ |\ \fB\-\-schema\fR\ \fIschema\fR\ ]...  [\ \fB\-t\fR\ |\ \fB\-\-table\fR\ \fItable\fR\ ]...  [\ \fB\-i\fR\ |\ \fB\-\-index\fR\ \fIindex\fR\ ]...  [\ \fB\-s\fR\ |\ \fB\-\-system\fR\ ]  [\fIdbname\fR\ |\ \fB\-a\fR\ |\ \fB\-\-all\fR]
35 .SH "DESCRIPTION"
36 .PP
37 reindexdb
38 is a utility for rebuilding indexes in a
39 PostgreSQL
40 database\&.
41 .PP
42 reindexdb
43 is a wrapper around the SQL command
44 \fBREINDEX\fR\&. There is no effective difference between reindexing databases via this utility and via other methods for accessing the server\&.
45 .SH "OPTIONS"
46 .PP
47 reindexdb
48 accepts the following command\-line arguments:
49 .PP
50 \fB\-a\fR
51 .br
52 \fB\-\-all\fR
53 .RS 4
54 Reindex all databases\&.
55 .RE
56 .PP
57 \fB\-\-concurrently\fR
58 .RS 4
59 Use the
60 CONCURRENTLY
61 option\&. See
62 \fBREINDEX\fR(7), where all the caveats of this option are explained in detail\&.
63 .RE
64 .PP
65 \fB[\-d]\fR\fB \fR\fB\fIdbname\fR\fR
66 .br
67 \fB[\-\-dbname=]\fR\fB\fIdbname\fR\fR
68 .RS 4
69 Specifies the name of the database to be reindexed, when
70 \fB\-a\fR/\fB\-\-all\fR
71 is not used\&. If this is not specified, the database name is read from the environment variable
72 \fBPGDATABASE\fR\&. If that is not set, the user name specified for the connection is used\&. The
73 \fIdbname\fR
74 can be a
75 connection string\&. If so, connection string parameters will override any conflicting command line options\&.
76 .RE
77 .PP
78 \fB\-e\fR
79 .br
80 \fB\-\-echo\fR
81 .RS 4
82 Echo the commands that
83 reindexdb
84 generates and sends to the server\&.
85 .RE
86 .PP
87 \fB\-i \fR\fB\fIindex\fR\fR
88 .br
89 \fB\-\-index=\fR\fB\fIindex\fR\fR
90 .RS 4
91 Recreate
92 \fIindex\fR
93 only\&. Multiple indexes can be recreated by writing multiple
94 \fB\-i\fR
95 switches\&.
96 .RE
97 .PP
98 \fB\-j \fR\fB\fInjobs\fR\fR
99 .br
100 \fB\-\-jobs=\fR\fB\fInjobs\fR\fR
101 .RS 4
102 Execute the reindex commands in parallel by running
103 \fInjobs\fR
104 commands simultaneously\&. This option may reduce the processing time but it also increases the load on the database server\&.
105 .sp
106 reindexdb
107 will open
108 \fInjobs\fR
109 connections to the database, so make sure your
110 max_connections
111 setting is high enough to accommodate all connections\&.
112 .sp
113 Note that this option is incompatible with the
114 \fB\-\-system\fR
115 option\&.
116 .RE
117 .PP
118 \fB\-q\fR
119 .br
120 \fB\-\-quiet\fR
121 .RS 4
122 Do not display progress messages\&.
123 .RE
124 .PP
125 \fB\-s\fR
126 .br
127 \fB\-\-system\fR
128 .RS 4
129 Reindex database\*(Aqs system catalogs only\&.
130 .RE
131 .PP
132 \fB\-S \fR\fB\fIschema\fR\fR
133 .br
134 \fB\-\-schema=\fR\fB\fIschema\fR\fR
135 .RS 4
136 Reindex
137 \fIschema\fR
138 only\&. Multiple schemas can be reindexed by writing multiple
139 \fB\-S\fR
140 switches\&.
141 .RE
142 .PP
143 \fB\-t \fR\fB\fItable\fR\fR
144 .br
145 \fB\-\-table=\fR\fB\fItable\fR\fR
146 .RS 4
147 Reindex
148 \fItable\fR
149 only\&. Multiple tables can be reindexed by writing multiple
150 \fB\-t\fR
151 switches\&.
152 .RE
153 .PP
154 \fB\-\-tablespace=\fR\fB\fItablespace\fR\fR
155 .RS 4
156 Specifies the tablespace where indexes are rebuilt\&. (This name is processed as a double\-quoted identifier\&.)
157 .RE
158 .PP
159 \fB\-v\fR
160 .br
161 \fB\-\-verbose\fR
162 .RS 4
163 Print detailed information during processing\&.
164 .RE
165 .PP
166 \fB\-V\fR
167 .br
168 \fB\-\-version\fR
169 .RS 4
170 Print the
171 reindexdb
172 version and exit\&.
173 .RE
174 .PP
175 \fB\-?\fR
176 .br
177 \fB\-\-help\fR
178 .RS 4
179 Show help about
180 reindexdb
181 command line arguments, and exit\&.
182 .RE
183 .PP
184 reindexdb
185 also accepts the following command\-line arguments for connection parameters:
186 .PP
187 \fB\-h \fR\fB\fIhost\fR\fR
188 .br
189 \fB\-\-host=\fR\fB\fIhost\fR\fR
190 .RS 4
191 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\&.
192 .RE
193 .PP
194 \fB\-p \fR\fB\fIport\fR\fR
195 .br
196 \fB\-\-port=\fR\fB\fIport\fR\fR
197 .RS 4
198 Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections\&.
199 .RE
200 .PP
201 \fB\-U \fR\fB\fIusername\fR\fR
202 .br
203 \fB\-\-username=\fR\fB\fIusername\fR\fR
204 .RS 4
205 User name to connect as\&.
206 .RE
207 .PP
208 \fB\-w\fR
209 .br
210 \fB\-\-no\-password\fR
211 .RS 4
212 Never issue a password prompt\&. If the server requires password authentication and a password is not available by other means such as a
213 \&.pgpass
214 file, the connection attempt will fail\&. This option can be useful in batch jobs and scripts where no user is present to enter a password\&.
215 .RE
216 .PP
217 \fB\-W\fR
218 .br
219 \fB\-\-password\fR
220 .RS 4
221 Force
222 reindexdb
223 to prompt for a password before connecting to a database\&.
224 .sp
225 This option is never essential, since
226 reindexdb
227 will automatically prompt for a password if the server demands password authentication\&. However,
228 reindexdb
229 will waste a connection attempt finding out that the server wants a password\&. In some cases it is worth typing
230 \fB\-W\fR
231 to avoid the extra connection attempt\&.
232 .RE
233 .PP
234 \fB\-\-maintenance\-db=\fR\fB\fIdbname\fR\fR
235 .RS 4
236 When the
237 \fB\-a\fR/\fB\-\-all\fR
238 is used, connect to this database to gather the list of databases to reindex\&. If not specified, the
239 postgres
240 database will be used, or if that does not exist,
241 template1
242 will be used\&. This can be a
243 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\&.
244 .RE
245 .SH "ENVIRONMENT"
246 .PP
247 \fBPGDATABASE\fR
248 .br
249 \fBPGHOST\fR
250 .br
251 \fBPGPORT\fR
252 .br
253 \fBPGUSER\fR
254 .RS 4
255 Default connection parameters
256 .RE
257 .PP
258 \fBPG_COLOR\fR
259 .RS 4
260 Specifies whether to use color in diagnostic messages\&. Possible values are
261 always,
262 auto
263 and
264 never\&.
265 .RE
266 .PP
267 This utility, like most other
268 PostgreSQL
269 utilities, also uses the environment variables supported by
270 libpq
271 (see
272 Section\ \&32.15)\&.
273 .SH "DIAGNOSTICS"
274 .PP
275 In case of difficulty, see
276 \fBREINDEX\fR(7)
277 and
278 \fBpsql\fR(1)
279 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
280 libpq
281 front\-end library will apply\&.
282 .SH "EXAMPLES"
283 .PP
284 To reindex the database
285 test:
286 .sp
287 .if n \{\
288 .RS 4
289 .\}
290 .nf
291 $ \fBreindexdb test\fR
292 .fi
293 .if n \{\
294 .RE
295 .\}
296 .PP
297 To reindex the table
298 foo
299 and the index
300 bar
301 in a database named
302 abcd:
303 .sp
304 .if n \{\
305 .RS 4
306 .\}
307 .nf
308 $ \fBreindexdb \-\-table=foo \-\-index=bar abcd\fR
309 .fi
310 .if n \{\
311 .RE
312 .\}
313 .SH "SEE ALSO"
314 \fBREINDEX\fR(7)