Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
app-reindexdb.html164 linesDownload Raw Back to html
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>reindexdb</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="app-psql.html" title="psql" /><link rel="next" href="app-vacuumdb.html" title="vacuumdb" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span class="application">reindexdb</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-psql.html" title="psql">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><th width="60%" align="center">PostgreSQL Client Applications</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-vacuumdb.html" title="vacuumdb">Next</a></td></tr></table><hr /></div><div class="refentry" id="APP-REINDEXDB"><div class="titlepage"></div><a id="id-1.9.4.21.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">reindexdb</span></span></h2><p>reindexdb — reindex a <span class="productname">PostgreSQL</span> database</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.4.21.4.1"><code class="command">reindexdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]  3    [4       <code class="option">-S</code>  |   <code class="option">--schema</code>  5     <em class="replaceable"><code>schema</code></em>6    ]7   ...   8    [9       <code class="option">-t</code>  |   <code class="option">--table</code>  10     <em class="replaceable"><code>table</code></em>11    ]12   ...   13    [14       <code class="option">-i</code>  |   <code class="option">--index</code>  15     <em class="replaceable"><code>index</code></em>16    ]17   ...  [<em class="replaceable"><code>dbname</code></em>]</p></div><div class="cmdsynopsis"><p id="id-1.9.4.21.4.2"><code class="command">reindexdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]   <code class="option">-a</code>  |   <code class="option">--all</code>  </p></div><div class="cmdsynopsis"><p id="id-1.9.4.21.4.3"><code class="command">reindexdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]   <code class="option">-s</code>  |   <code class="option">--system</code>   [<em class="replaceable"><code>dbname</code></em>]</p></div></div><div class="refsect1" id="id-1.9.4.21.5"><h2>Description</h2><p>18   <span class="application">reindexdb</span> is a utility for rebuilding indexes19   in a <span class="productname">PostgreSQL</span> database.20  </p><p>21   <span class="application">reindexdb</span> is a wrapper around the SQL22   command <a class="link" href="sql-reindex.html" title="REINDEX"><code class="command">REINDEX</code></a>.23   There is no effective difference between reindexing databases via24   this utility and via other methods for accessing the server.25  </p></div><div class="refsect1" id="id-1.9.4.21.6"><h2>Options</h2><p>26    <span class="application">reindexdb</span> accepts the following command-line arguments:27 28    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-a</code><br /></span><span class="term"><code class="option">--all</code></span></dt><dd><p>29        Reindex all databases.30       </p></dd><dt><span class="term"><code class="option">--concurrently</code></span></dt><dd><p>31        Use the <code class="literal">CONCURRENTLY</code> option.  See32        <a class="xref" href="sql-reindex.html" title="REINDEX"><span class="refentrytitle">REINDEX</span></a>, where all the caveats of this option33        are explained in detail.34       </p></dd><dt><span class="term"><code class="option">[<span class="optional">-d</span>] <em class="replaceable"><code>dbname</code></em></code><br /></span><span class="term"><code class="option">[<span class="optional">--dbname=</span>]<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>35        Specifies the name of the database to be reindexed,36        when <code class="option">-a</code>/<code class="option">--all</code> is not used.37        If this is not specified, the database name is read38        from the environment variable <code class="envar">PGDATABASE</code>.  If39        that is not set, the user name specified for the connection is40        used.  The <em class="replaceable"><code>dbname</code></em> can be a <a class="link" href="libpq-connect.html#LIBPQ-CONNSTRING" title="34.1.1. Connection Strings">connection string</a>.  If so,41        connection string parameters will override any conflicting command42        line options.43       </p></dd><dt><span class="term"><code class="option">-e</code><br /></span><span class="term"><code class="option">--echo</code></span></dt><dd><p>44        Echo the commands that <span class="application">reindexdb</span> generates45        and sends to the server.46       </p></dd><dt><span class="term"><code class="option">-i <em class="replaceable"><code>index</code></em></code><br /></span><span class="term"><code class="option">--index=<em class="replaceable"><code>index</code></em></code></span></dt><dd><p>47        Recreate <em class="replaceable"><code>index</code></em> only.48        Multiple indexes can be recreated by writing multiple49        <code class="option">-i</code> switches.50       </p></dd><dt><span class="term"><code class="option">-j <em class="replaceable"><code>njobs</code></em></code><br /></span><span class="term"><code class="option">--jobs=<em class="replaceable"><code>njobs</code></em></code></span></dt><dd><p>51        Execute the reindex commands in parallel by running52        <em class="replaceable"><code>njobs</code></em>53        commands simultaneously.  This option may reduce the processing time54        but it also increases the load on the database server.55       </p><p>56        <span class="application">reindexdb</span> will open57        <em class="replaceable"><code>njobs</code></em> connections to the58        database, so make sure your <a class="xref" href="runtime-config-connection.html#GUC-MAX-CONNECTIONS">max_connections</a>59        setting is high enough to accommodate all connections.60       </p><p>61        Note that this option is incompatible with the <code class="option">--index</code>62        and <code class="option">--system</code> options.63       </p></dd><dt><span class="term"><code class="option">-q</code><br /></span><span class="term"><code class="option">--quiet</code></span></dt><dd><p>64        Do not display progress messages.65       </p></dd><dt><span class="term"><code class="option">-s</code><br /></span><span class="term"><code class="option">--system</code></span></dt><dd><p>66        Reindex database's system catalogs only.67       </p></dd><dt><span class="term"><code class="option">-S <em class="replaceable"><code>schema</code></em></code><br /></span><span class="term"><code class="option">--schema=<em class="replaceable"><code>schema</code></em></code></span></dt><dd><p>68        Reindex <em class="replaceable"><code>schema</code></em> only.69        Multiple schemas can be reindexed by writing multiple70        <code class="option">-S</code> switches.71       </p></dd><dt><span class="term"><code class="option">-t <em class="replaceable"><code>table</code></em></code><br /></span><span class="term"><code class="option">--table=<em class="replaceable"><code>table</code></em></code></span></dt><dd><p>72        Reindex <em class="replaceable"><code>table</code></em> only.73        Multiple tables can be reindexed by writing multiple74        <code class="option">-t</code> switches.75       </p></dd><dt><span class="term"><code class="option">--tablespace=<em class="replaceable"><code>tablespace</code></em></code></span></dt><dd><p>76        Specifies the tablespace where indexes are rebuilt. (This name is77        processed as a double-quoted identifier.)78       </p></dd><dt><span class="term"><code class="option">-v</code><br /></span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>79       Print detailed information during processing.80      </p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>81       Print the <span class="application">reindexdb</span> version and exit.82       </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>83      Show help about <span class="application">reindexdb</span> command line84      arguments, and exit.85      </p></dd></dl></div><p>86 87   </p><p>88    <span class="application">reindexdb</span> also accepts89    the following command-line arguments for connection parameters:90 91    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-h <em class="replaceable"><code>host</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>host</code></em></code></span></dt><dd><p>92        Specifies the host name of the machine on which the server is93        running.  If the value begins with a slash, it is used as the94        directory for the Unix domain socket.95       </p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>96        Specifies the TCP port or local Unix domain socket file97        extension on which the server98        is listening for connections.99       </p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>100        User name to connect as.101       </p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p>102        Never issue a password prompt.  If the server requires103        password authentication and a password is not available by104        other means such as a <code class="filename">.pgpass</code> file, the105        connection attempt will fail.  This option can be useful in106        batch jobs and scripts where no user is present to enter a107        password.108       </p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p>109        Force <span class="application">reindexdb</span> to prompt for a110        password before connecting to a database.111       </p><p>112        This option is never essential, since113        <span class="application">reindexdb</span> will automatically prompt114        for a password if the server demands password authentication.115        However, <span class="application">reindexdb</span> will waste a116        connection attempt finding out that the server wants a password.117        In some cases it is worth typing <code class="option">-W</code> to avoid the extra118        connection attempt.119       </p></dd><dt><span class="term"><code class="option">--maintenance-db=<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>120        Specifies the name of the database to connect to to discover which121        databases should be reindexed,122        when <code class="option">-a</code>/<code class="option">--all</code> is used.123        If not specified, the <code class="literal">postgres</code> database will be used,124        or if that does not exist, <code class="literal">template1</code> will be used.125        This can be a <a class="link" href="libpq-connect.html#LIBPQ-CONNSTRING" title="34.1.1. Connection Strings">connection126        string</a>.  If so, connection string parameters will override any127        conflicting command line options.  Also, connection string parameters128        other than the database name itself will be re-used when connecting129        to other databases.130       </p></dd></dl></div><p>131   </p></div><div class="refsect1" id="id-1.9.4.21.7"><h2>Environment</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGDATABASE</code><br /></span><span class="term"><code class="envar">PGHOST</code><br /></span><span class="term"><code class="envar">PGPORT</code><br /></span><span class="term"><code class="envar">PGUSER</code></span></dt><dd><p>132      Default connection parameters133     </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>134      Specifies whether to use color in diagnostic messages. Possible values135      are <code class="literal">always</code>, <code class="literal">auto</code> and136      <code class="literal">never</code>.137     </p></dd></dl></div><p>138   This utility, like most other <span class="productname">PostgreSQL</span> utilities,139   also uses the environment variables supported by <span class="application">libpq</span>140   (see <a class="xref" href="libpq-envars.html" title="34.15. Environment Variables">Section 34.15</a>).141  </p></div><div class="refsect1" id="id-1.9.4.21.8"><h2>Diagnostics</h2><p>142   In case of difficulty, see <a class="xref" href="sql-reindex.html" title="REINDEX"><span class="refentrytitle">REINDEX</span></a>143   and <a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a> for144   discussions of potential problems and error messages.145   The database server must be running at the146   targeted host.  Also, any default connection settings and environment147   variables used by the <span class="application">libpq</span> front-end148   library will apply.149  </p></div><div class="refsect1" id="id-1.9.4.21.9"><h2>Notes</h2><p>150   <span class="application">reindexdb</span> might need to connect several151   times to the <span class="productname">PostgreSQL</span> server, asking152   for a password each time. It is convenient to have a153   <code class="filename">~/.pgpass</code> file in such cases. See <a class="xref" href="libpq-pgpass.html" title="34.16. The Password File">Section 34.16</a> for more information.154  </p></div><div class="refsect1" id="id-1.9.4.21.10"><h2>Examples</h2><p>155    To reindex the database <code class="literal">test</code>:156</p><pre class="screen">157<code class="prompt">$ </code><strong class="userinput"><code>reindexdb test</code></strong>158</pre><p>159   </p><p>160    To reindex the table <code class="literal">foo</code> and the index161    <code class="literal">bar</code> in a database named <code class="literal">abcd</code>:162</p><pre class="screen">163<code class="prompt">$ </code><strong class="userinput"><code>reindexdb --table=foo --index=bar abcd</code></strong>164</pre></div><div class="refsect1" id="id-1.9.4.21.11"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-reindex.html" title="REINDEX"><span class="refentrytitle">REINDEX</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-psql.html" title="psql">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-vacuumdb.html" title="vacuumdb">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">psql</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> <span class="application">vacuumdb</span></td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai