gooderp18绿色标准版
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

140 lines
14KB

  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 V1.79.1" /><link rel="prev" href="app-psql.html" title="psql" /><link rel="next" href="app-vacuumdb.html" title="vacuumdb" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span xmlns="http://www.w3.org/1999/xhtml" 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 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-vacuumdb.html" title="vacuumdb">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="APP-REINDEXDB"><div class="titlepage"></div><a id="id-1.9.4.19.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.19.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">--schema</code> | <code class="option">-S</code>
  5. <em class="replaceable"><code>schema</code></em>
  6. ]
  7. ...
  8. [
  9. <code class="option">--table</code> | <code class="option">-t</code>
  10. <em class="replaceable"><code>table</code></em>
  11. ]
  12. ...
  13. [
  14. <code class="option">--index</code> | <code class="option">-i</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.19.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">--all</code> | <code class="option">-a</code> </p></div><div class="cmdsynopsis"><p id="id-1.9.4.19.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">--system</code> | <code class="option">-s</code> [<em class="replaceable"><code>dbname</code></em>]</p></div></div><div class="refsect1" id="id-1.9.4.19.5"><h2>Description</h2><p>
  18. <span class="application">reindexdb</span> is a utility for rebuilding indexes
  19. in a <span class="productname">PostgreSQL</span> database.
  20. </p><p>
  21. <span class="application">reindexdb</span> is a wrapper around the SQL
  22. command <a class="xref" href="sql-reindex.html" title="REINDEX"><span class="refentrytitle">REINDEX</span></a>.
  23. There is no effective difference between reindexing databases via
  24. this utility and via other methods for accessing the server.
  25. </p></div><div class="refsect1" id="id-1.9.4.19.6"><h2>Options</h2><p>
  26. <span class="application">reindexdb</span> accepts the following command-line arguments:
  27. </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>
  28. Reindex all databases.
  29. </p></dd><dt><span class="term"><code class="option">--concurrently</code></span></dt><dd><p>
  30. Use the <code class="literal">CONCURRENTLY</code> option. See
  31. <a class="xref" href="sql-reindex.html" title="REINDEX"><span class="refentrytitle">REINDEX</span></a>, where all the caveats of this option
  32. are explained in detail.
  33. </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>
  34. Specifies the name of the database to be reindexed.
  35. If this is not specified and <code class="option">-a</code> (or
  36. <code class="option">--all</code>) is not used, the database name is read
  37. from the environment variable <code class="envar">PGDATABASE</code>. If
  38. that is not set, the user name specified for the connection is
  39. used.
  40. </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>
  41. Echo the commands that <span class="application">reindexdb</span> generates
  42. and sends to the server.
  43. </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>
  44. Recreate <em class="replaceable"><code>index</code></em> only.
  45. Multiple indexes can be recreated by writing multiple
  46. <code class="option">-i</code> switches.
  47. </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>
  48. Do not display progress messages.
  49. </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>
  50. Reindex database's system catalogs.
  51. </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>
  52. Reindex <em class="replaceable"><code>schema</code></em> only.
  53. Multiple schemas can be reindexed by writing multiple
  54. <code class="option">-S</code> switches.
  55. </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>
  56. Reindex <em class="replaceable"><code>table</code></em> only.
  57. Multiple tables can be reindexed by writing multiple
  58. <code class="option">-t</code> switches.
  59. </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>
  60. Print detailed information during processing.
  61. </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>
  62. Print the <span class="application">reindexdb</span> version and exit.
  63. </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
  64. Show help about <span class="application">reindexdb</span> command line
  65. arguments, and exit.
  66. </p></dd></dl></div><p>
  67. </p><p>
  68. <span class="application">reindexdb</span> also accepts
  69. the following command-line arguments for connection parameters:
  70. </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>
  71. Specifies the host name of the machine on which the server is
  72. running. If the value begins with a slash, it is used as the
  73. directory for the Unix domain socket.
  74. </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>
  75. Specifies the TCP port or local Unix domain socket file
  76. extension on which the server
  77. is listening for connections.
  78. </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>
  79. User name to connect as.
  80. </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>
  81. Never issue a password prompt. If the server requires
  82. password authentication and a password is not available by
  83. other means such as a <code class="filename">.pgpass</code> file, the
  84. connection attempt will fail. This option can be useful in
  85. batch jobs and scripts where no user is present to enter a
  86. password.
  87. </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>
  88. Force <span class="application">reindexdb</span> to prompt for a
  89. password before connecting to a database.
  90. </p><p>
  91. This option is never essential, since
  92. <span class="application">reindexdb</span> will automatically prompt
  93. for a password if the server demands password authentication.
  94. However, <span class="application">reindexdb</span> will waste a
  95. connection attempt finding out that the server wants a password.
  96. In some cases it is worth typing <code class="option">-W</code> to avoid the extra
  97. connection attempt.
  98. </p></dd><dt><span class="term"><code class="option">--maintenance-db=<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>
  99. Specifies the name of the database to connect to discover what other
  100. databases should be reindexed. If not specified, the
  101. <code class="literal">postgres</code> database will be used,
  102. and if that does not exist, <code class="literal">template1</code> will be used.
  103. </p></dd></dl></div><p>
  104. </p></div><div class="refsect1" id="id-1.9.4.19.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>
  105. Default connection parameters
  106. </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
  107. Specifies whether to use color in diagnostic messages. Possible values
  108. are <code class="literal">always</code>, <code class="literal">auto</code> and
  109. <code class="literal">never</code>.
  110. </p></dd></dl></div><p>
  111. This utility, like most other <span class="productname">PostgreSQL</span> utilities,
  112. also uses the environment variables supported by <span class="application">libpq</span>
  113. (see <a class="xref" href="libpq-envars.html" title="33.14. Environment Variables">Section 33.14</a>).
  114. </p></div><div class="refsect1" id="id-1.9.4.19.8"><h2>Diagnostics</h2><p>
  115. In case of difficulty, see <a class="xref" href="sql-reindex.html" title="REINDEX"><span class="refentrytitle">REINDEX</span></a>
  116. and <a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a> for
  117. discussions of potential problems and error messages.
  118. The database server must be running at the
  119. targeted host. Also, any default connection settings and environment
  120. variables used by the <span class="application">libpq</span> front-end
  121. library will apply.
  122. </p></div><div class="refsect1" id="id-1.9.4.19.9"><h2>Notes</h2><p>
  123. <span class="application">reindexdb</span> might need to connect several
  124. times to the <span class="productname">PostgreSQL</span> server, asking
  125. for a password each time. It is convenient to have a
  126. <code class="filename">~/.pgpass</code> file in such cases. See <a class="xref" href="libpq-pgpass.html" title="33.15. The Password File">Section 33.15</a> for more information.
  127. </p></div><div class="refsect1" id="id-1.9.4.19.10"><h2>Examples</h2><p>
  128. To reindex the database <code class="literal">test</code>:
  129. </p><pre class="screen">
  130. <code class="prompt">$ </code><strong class="userinput"><code>reindexdb test</code></strong>
  131. </pre><p>
  132. </p><p>
  133. To reindex the table <code class="literal">foo</code> and the index
  134. <code class="literal">bar</code> in a database named <code class="literal">abcd</code>:
  135. </p><pre class="screen">
  136. <code class="prompt">$ </code><strong class="userinput"><code>reindexdb --table=foo --index=bar abcd</code></strong>
  137. </pre></div><div class="refsect1" id="id-1.9.4.19.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">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-vacuumdb.html">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">Home</a></td><td width="40%" align="right" valign="top"> <span class="application">vacuumdb</span></td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1