gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 satır
12KB

  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>clusterdb</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="reference-client.html" title="PostgreSQL Client Applications" /><link rel="next" href="app-createdb.html" title="createdb" /></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">clusterdb</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="reference-client.html" title="PostgreSQL Client Applications">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-createdb.html" title="createdb">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="APP-CLUSTERDB"><div class="titlepage"></div><a id="id-1.9.4.3.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">clusterdb</span></span></h2><p>clusterdb — cluster a <span class="productname">PostgreSQL</span> database</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.4.3.4.1"><code class="command">clusterdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [ <code class="option">--verbose</code> | <code class="option">-v</code> ]
  3. [
  4. <code class="option">--table</code> | <code class="option">-t</code>
  5. <em class="replaceable"><code>table</code></em>
  6. ]
  7. ... [<em class="replaceable"><code>dbname</code></em>]</p></div><div class="cmdsynopsis"><p id="id-1.9.4.3.4.2"><code class="command">clusterdb</code> [<em class="replaceable"><code>connection-option</code></em>...] [ <code class="option">--verbose</code> | <code class="option">-v</code> ] <code class="option">--all</code> | <code class="option">-a</code> </p></div></div><div class="refsect1" id="id-1.9.4.3.5"><h2>Description</h2><p>
  8. <span class="application">clusterdb</span> is a utility for reclustering tables
  9. in a <span class="productname">PostgreSQL</span> database. It finds tables
  10. that have previously been clustered, and clusters them again on the same
  11. index that was last used. Tables that have never been clustered are not
  12. affected.
  13. </p><p>
  14. <span class="application">clusterdb</span> is a wrapper around the SQL
  15. command <a class="xref" href="sql-cluster.html" title="CLUSTER"><span class="refentrytitle">CLUSTER</span></a>.
  16. There is no effective difference between clustering databases via
  17. this utility and via other methods for accessing the server.
  18. </p></div><div class="refsect1" id="id-1.9.4.3.6"><h2>Options</h2><p>
  19. <span class="application">clusterdb</span> accepts the following command-line arguments:
  20. </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>
  21. Cluster all databases.
  22. </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>
  23. Specifies the name of the database to be clustered.
  24. If this is not specified and <code class="option">-a</code> (or
  25. <code class="option">--all</code>) is not used, the database name is read
  26. from the environment variable <code class="envar">PGDATABASE</code>. If
  27. that is not set, the user name specified for the connection is
  28. used.
  29. </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>
  30. Echo the commands that <span class="application">clusterdb</span> generates
  31. and sends to the server.
  32. </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>
  33. Do not display progress messages.
  34. </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>
  35. Cluster <em class="replaceable"><code>table</code></em> only.
  36. Multiple tables can be clustered by writing multiple
  37. <code class="option">-t</code> switches.
  38. </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>
  39. Print detailed information during processing.
  40. </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>
  41. Print the <span class="application">clusterdb</span> version and exit.
  42. </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
  43. Show help about <span class="application">clusterdb</span> command line
  44. arguments, and exit.
  45. </p></dd></dl></div><p>
  46. </p><p>
  47. <span class="application">clusterdb</span> also accepts
  48. the following command-line arguments for connection parameters:
  49. </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>
  50. Specifies the host name of the machine on which the server is
  51. running. If the value begins with a slash, it is used as the
  52. directory for the Unix domain socket.
  53. </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>
  54. Specifies the TCP port or local Unix domain socket file
  55. extension on which the server
  56. is listening for connections.
  57. </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>
  58. User name to connect as.
  59. </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>
  60. Never issue a password prompt. If the server requires
  61. password authentication and a password is not available by
  62. other means such as a <code class="filename">.pgpass</code> file, the
  63. connection attempt will fail. This option can be useful in
  64. batch jobs and scripts where no user is present to enter a
  65. password.
  66. </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>
  67. Force <span class="application">clusterdb</span> to prompt for a
  68. password before connecting to a database.
  69. </p><p>
  70. This option is never essential, since
  71. <span class="application">clusterdb</span> will automatically prompt
  72. for a password if the server demands password authentication.
  73. However, <span class="application">clusterdb</span> will waste a
  74. connection attempt finding out that the server wants a password.
  75. In some cases it is worth typing <code class="option">-W</code> to avoid the extra
  76. connection attempt.
  77. </p></dd><dt><span class="term"><code class="option">--maintenance-db=<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>
  78. Specifies the name of the database to connect to discover what other
  79. databases should be clustered. If not specified, the
  80. <code class="literal">postgres</code> database will be used,
  81. and if that does not exist, <code class="literal">template1</code> will be used.
  82. </p></dd></dl></div><p>
  83. </p></div><div class="refsect1" id="id-1.9.4.3.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>
  84. Default connection parameters
  85. </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
  86. Specifies whether to use color in diagnostic messages. Possible values
  87. are <code class="literal">always</code>, <code class="literal">auto</code> and
  88. <code class="literal">never</code>.
  89. </p></dd></dl></div><p>
  90. This utility, like most other <span class="productname">PostgreSQL</span> utilities,
  91. also uses the environment variables supported by <span class="application">libpq</span>
  92. (see <a class="xref" href="libpq-envars.html" title="33.14. Environment Variables">Section 33.14</a>).
  93. </p></div><div class="refsect1" id="id-1.9.4.3.8"><h2>Diagnostics</h2><p>
  94. In case of difficulty, see <a class="xref" href="sql-cluster.html" title="CLUSTER"><span class="refentrytitle">CLUSTER</span></a>
  95. and <a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a> for
  96. discussions of potential problems and error messages.
  97. The database server must be running at the
  98. targeted host. Also, any default connection settings and environment
  99. variables used by the <span class="application">libpq</span> front-end
  100. library will apply.
  101. </p></div><div class="refsect1" id="id-1.9.4.3.9"><h2>Examples</h2><p>
  102. To cluster the database <code class="literal">test</code>:
  103. </p><pre class="screen">
  104. <code class="prompt">$ </code><strong class="userinput"><code>clusterdb test</code></strong>
  105. </pre><p>
  106. </p><p>
  107. To cluster a single table
  108. <code class="literal">foo</code> in a database named
  109. <code class="literal">xyzzy</code>:
  110. </p><pre class="screen">
  111. <code class="prompt">$ </code><strong class="userinput"><code>clusterdb --table=foo xyzzy</code></strong>
  112. </pre></div><div class="refsect1" id="id-1.9.4.3.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-cluster.html" title="CLUSTER"><span class="refentrytitle">CLUSTER</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="reference-client.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-createdb.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">PostgreSQL Client Applications </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">createdb</span></td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1