]> begriffs open source - ai-pg/blob - full-docs/txt/app-reindexdb.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / app-reindexdb.txt
1
2 reindexdb
3
4    reindexdb — reindex a PostgreSQL database
5
6 Synopsis
7
8    reindexdb [connection-option...] [option...] [ -S | --schema schema ]
9    ... [ -t | --table table ] ... [ -i | --index index ] ... [ -s |
10    --system ] [ dbname | -a | --all ]
11
12 Description
13
14    reindexdb is a utility for rebuilding indexes in a PostgreSQL database.
15
16    reindexdb is a wrapper around the SQL command REINDEX. There is no
17    effective difference between reindexing databases via this utility and
18    via other methods for accessing the server.
19
20 Options
21
22    reindexdb accepts the following command-line arguments:
23
24    -a
25           --all
26           Reindex all databases.
27
28    --concurrently
29           Use the CONCURRENTLY option. See REINDEX, where all the caveats
30           of this option are explained in detail.
31
32    [-d] dbname
33           [--dbname=]dbname
34           Specifies the name of the database to be reindexed, when
35           -a/--all is not used. If this is not specified, the database
36           name is read from the environment variable PGDATABASE. If that
37           is not set, the user name specified for the connection is used.
38           The dbname can be a connection string. If so, connection string
39           parameters will override any conflicting command line options.
40
41    -e
42           --echo
43           Echo the commands that reindexdb generates and sends to the
44           server.
45
46    -i index
47           --index=index
48           Recreate index only. Multiple indexes can be recreated by
49           writing multiple -i switches.
50
51    -j njobs
52           --jobs=njobs
53           Execute the reindex commands in parallel by running njobs
54           commands simultaneously. This option may reduce the processing
55           time but it also increases the load on the database server.
56
57           reindexdb will open njobs connections to the database, so make
58           sure your max_connections setting is high enough to accommodate
59           all connections.
60
61           Note that this option is incompatible with the --system option.
62
63    -q
64           --quiet
65           Do not display progress messages.
66
67    -s
68           --system
69           Reindex database's system catalogs only.
70
71    -S schema
72           --schema=schema
73           Reindex schema only. Multiple schemas can be reindexed by
74           writing multiple -S switches.
75
76    -t table
77           --table=table
78           Reindex table only. Multiple tables can be reindexed by writing
79           multiple -t switches.
80
81    --tablespace=tablespace
82           Specifies the tablespace where indexes are rebuilt. (This name
83           is processed as a double-quoted identifier.)
84
85    -v
86           --verbose
87           Print detailed information during processing.
88
89    -V
90           --version
91           Print the reindexdb version and exit.
92
93    -?
94           --help
95           Show help about reindexdb command line arguments, and exit.
96
97    reindexdb also accepts the following command-line arguments for
98    connection parameters:
99
100    -h host
101           --host=host
102           Specifies the host name of the machine on which the server is
103           running. If the value begins with a slash, it is used as the
104           directory for the Unix domain socket.
105
106    -p port
107           --port=port
108           Specifies the TCP port or local Unix domain socket file
109           extension on which the server is listening for connections.
110
111    -U username
112           --username=username
113           User name to connect as.
114
115    -w
116           --no-password
117           Never issue a password prompt. If the server requires password
118           authentication and a password is not available by other means
119           such as a .pgpass file, the connection attempt will fail. This
120           option can be useful in batch jobs and scripts where no user is
121           present to enter a password.
122
123    -W
124           --password
125           Force reindexdb to prompt for a password before connecting to a
126           database.
127
128           This option is never essential, since reindexdb will
129           automatically prompt for a password if the server demands
130           password authentication. However, reindexdb will waste a
131           connection attempt finding out that the server wants a password.
132           In some cases it is worth typing -W to avoid the extra
133           connection attempt.
134
135    --maintenance-db=dbname
136           When the -a/--all is used, connect to this database to gather
137           the list of databases to reindex. If not specified, the postgres
138           database will be used, or if that does not exist, template1 will
139           be used. This can be a connection string. If so, connection
140           string parameters will override any conflicting command line
141           options. Also, connection string parameters other than the
142           database name itself will be re-used when connecting to other
143           databases.
144
145 Environment
146
147    PGDATABASE
148           PGHOST
149           PGPORT
150           PGUSER
151           Default connection parameters
152
153    PG_COLOR
154           Specifies whether to use color in diagnostic messages. Possible
155           values are always, auto and never.
156
157    This utility, like most other PostgreSQL utilities, also uses the
158    environment variables supported by libpq (see Section 32.15).
159
160 Diagnostics
161
162    In case of difficulty, see REINDEX and psql 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
167 Examples
168
169    To reindex the database test:
170 $ reindexdb test
171
172    To reindex the table foo and the index bar in a database named abcd:
173 $ reindexdb --table=foo --index=bar abcd
174
175 See Also
176
177    REINDEX