diff options
-rw-r--r-- | doc/src/sgml/ref/select.sgml | 316 | ||||
-rw-r--r-- | doc/src/sgml/ref/select_into.sgml | 24 | ||||
-rw-r--r-- | doc/src/sgml/ref/set.sgml | 4 | ||||
-rw-r--r-- | doc/src/sgml/ref/show.sgml | 53 | ||||
-rw-r--r-- | doc/src/sgml/ref/unlisten.sgml | 351 | ||||
-rw-r--r-- | doc/src/sgml/ref/update.sgml | 392 | ||||
-rw-r--r-- | doc/src/sgml/ref/vacuum.sgml | 453 | ||||
-rw-r--r-- | doc/src/sgml/ref/vacuumdb.sgml | 106 |
8 files changed, 865 insertions, 834 deletions
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 4e983118739..56c3d554051 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -1,13 +1,13 @@ <refentry id="SQL-SELECT"> <refmeta> <refentrytitle> -SELECT + SELECT </refentrytitle> <refmiscinfo>SQL - Language Statements</refmiscinfo> </refmeta> <refnamediv> <refname> -SELECT + SELECT </refname> <refpurpose> Retrieve rows from a table or view. @@ -17,20 +17,17 @@ SELECT <date>1998-09-24</date> </refsynopsisdivinfo> <synopsis> -SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] - <replaceable class="PARAMETER">expression</replaceable> [ AS - <replaceable class="PARAMETER">name</replaceable> ] [, ...] - [ INTO [TEMP] [TABLE] <replaceable class="PARAMETER">new_table</replaceable> ] - [ FROM <replaceable class="PARAMETER">table</replaceable> - [<replaceable class="PARAMETER">alias</replaceable> ] [, ...] ] +SELECT [ ALL | DISTINCT [ ON <replaceable class="PARAMETER">column</replaceable> ] ] + <replaceable class="PARAMETER">expression</replaceable> [ AS <replaceable class="PARAMETER">name</replaceable> ] [, ...] + [ INTO [ TEMPORARY | TEMP ] [ TABLE ] <replaceable class="PARAMETER">new_table</replaceable> ] + [ FROM <replaceable class="PARAMETER">table</replaceable> [ <replaceable class="PARAMETER">alias</replaceable> ] [, ...] ] [ WHERE <replaceable class="PARAMETER">condition</replaceable> ] [ GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...] ] [ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ] - [ { UNION [ALL] | INTERSECT | EXCEPT } <replaceable - class="PARAMETER">select</replaceable> ] + [ { UNION [ ALL ] | INTERSECT | EXCEPT } <replaceable class="PARAMETER">select</replaceable> ] [ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ] - [ FOR UPDATE [OF class_name...]] - [ LIMIT count [OFFSET|, count]] + [ FOR UPDATE [ OF class_name... ] ] + [ LIMIT { count | ALL } [ { OFFSET | , } count ] ] </synopsis> <refsect2 id="R2-SQL-SELECT-1"> @@ -40,13 +37,11 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] <title> Inputs </title> - + <para> <variablelist> <varlistentry> - <term> - <replaceable class="PARAMETER">expression</replaceable> - </term> + <term><replaceable class="PARAMETER">expression</replaceable></term> <listitem> <para> The name of a table's column or an expression. @@ -55,9 +50,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] </varlistentry> <varlistentry> - <term> - <replaceable class="PARAMETER">name</replaceable> - </term> + <term><replaceable class="PARAMETER">name</replaceable></term> <listitem> <para> Specifies another name for a column or an expression using @@ -70,9 +63,8 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] </varlistentry> <varlistentry> - <term> - TEMP - </term> + <term>TEMPORARY</term> + <term>TEMP</term> <listitem> <para> The table is created unique to this session, and is @@ -82,9 +74,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] </varlistentry> <varlistentry> - <term> - <replaceable class="PARAMETER">new_table</replaceable> - </term> + <term><replaceable class="PARAMETER">new_table</replaceable></term> <listitem> <para> If the INTO TABLE clause is specified, the result of the @@ -105,9 +95,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] </varlistentry> <varlistentry> - <term> - <replaceable class="PARAMETER">table</replaceable> - </term> + <term><replaceable class="PARAMETER">table</replaceable></term> <listitem> <para> The name of an existing table referenced by the FROM clause. @@ -116,9 +104,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] </varlistentry> <varlistentry> - <term> - <replaceable class="PARAMETER">alias</replaceable> - </term> + <term><replaceable class="PARAMETER">alias</replaceable></term> <listitem> <para> An alternate name for the preceding @@ -130,9 +116,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] </varlistentry> <varlistentry> - <term> - <replaceable class="PARAMETER">condition</replaceable> - </term> + <term><replaceable class="PARAMETER">condition</replaceable></term> <listitem> <para> A boolean expression giving a result of true or false. @@ -142,9 +126,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] </varlistentry> <varlistentry> - <term> - <replaceable class="PARAMETER">column</replaceable> - </term> + <term><replaceable class="PARAMETER">column</replaceable></term> <listitem> <para> The name of a table's column. @@ -153,9 +135,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] </varlistentry> <varlistentry> - <term> - <replaceable class="PARAMETER">select</replaceable> - </term> + <term><replaceable class="PARAMETER">select</replaceable></term> <listitem> <para> A select statement with all features except the ORDER BY clause. @@ -175,34 +155,32 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] Outputs </title> <para> - - <variablelist> - <varlistentry> - <term> - Rows - </term> - <listitem> - <para> - The complete set of rows resulting from the query specification. - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term> - <returnvalue><replaceable>count</replaceable></returnvalue> - </term> - <listitem> - <para> - The count of rows returned by the query. - </para> - </listitem> - </varlistentry> - </variablelist> + + <variablelist> + <varlistentry> + <term>Rows</term> + <listitem> + <para> + The complete set of rows resulting from the query specification. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <returnvalue><replaceable>count</replaceable></returnvalue> + </term> + <listitem> + <para> + The count of rows returned by the query. + </para> + </listitem> + </varlistentry> + </variablelist> </para> </refsect2> </refsynopsisdiv> - + <refsect1 id="R1-SQL-SELECT-1"> <refsect1info> <date>1998-09-24</date> @@ -213,69 +191,84 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ] <para> <command>SELECT</command> will return rows from one or more tables. Candidates for selection are rows which satisfy the WHERE condition; - if WHERE is omitted, all rows are candidates.</para> + if WHERE is omitted, all rows are candidates. + (See <xref linkend="where-title" endterm="where-title">.) + </para> + <para> <command>DISTINCT</command> will eliminate all duplicate rows from the selection. - <command>DISTINCT ON <replaceable class="PARAMETER">column</replaceable></command> will eliminate all duplicates in the specified column; this is -equivalent to using <command>GROUP BY <replaceable - class="PARAMETER">column</replaceable></command>. <command>ALL</command> will return all candidate rows, -including duplicates.</para> + <command>DISTINCT ON <replaceable class="PARAMETER">column</replaceable></command> + will eliminate all duplicates in the specified column; this is + equivalent to using + <command>GROUP BY <replaceable class="PARAMETER">column</replaceable></command>. + <command>ALL</command> will return all candidate rows, + including duplicates. + </para> <para> The GROUP BY clause allows a user to divide a table - conceptually into groups. (See GROUP BY clause).</para> - + conceptually into groups. + (See <xref linkend="group-by-title" endterm="group-by-title">.) + </para> + <para> The HAVING clause specifies a grouped table derived by the elimination of groups from the result of the previously - specified clause. (See HAVING clause).</para> + specified clause. + (See <xref linkend="having-title" endterm="having-title">.) + </para> <para> The ORDER BY clause allows a user to specify that he/she wishes the rows sorted according to the ASCending or - DESCending mode operator. (See ORDER BY clause)</para> + DESCending mode operator. + (See <xref linkend="order-by-title" endterm="order-by-title">.) + </para> <para> The UNION clause allows the result to be the collection of rows - returned by the queries involved. (See UNION clause).</para> + returned by the queries involved. + (See <xref linkend="union-title" endterm="union-title">.) + </para> <para> The INTERSECT give you the rows that are common to both queries. - (See INTERSECT clause).</para> + (See <xref linkend="intersect-title" endterm="intersect-title">.) + </para> <para> The EXCEPT give you the rows in the upper query not in the lower query. - (See EXCEPT clause).</para> + (See <xref linkend="except-title" endterm="except-title">.) + </para> <para> The FOR UPDATE clause allows the SELECT statement to perform exclusive locking of selected rows. - (See EXCEPT clause).</para> + </para> <para> The LIMIT...OFFSET clause allows control over which rows are - returned by the query.</para> + returned by the query. + </para> <para> You must have SELECT privilege to a table to read its values - (See <command>GRANT</command>/<command>REVOKE</command> statements). -</para> + (See the <command>GRANT</command>/<command>REVOKE</command> statements). + </para> <refsect2 id="R2-SQL-WHERE-2"> <refsect2info> <date>1998-09-24</date> </refsect2info> - <title> + <title id="where-title"> WHERE Clause </title> <para> The optional WHERE condition has the general form: <synopsis> -WHERE <replaceable class="PARAMETER">expr</replaceable> <replaceable -class="PARAMETER">ETER">c</replaceable>e<replaceable class="PARAMETER">"PAR</replaceable>replaceable> [ <replaceable -class="PARAMETER">log_op</replaceable> ... ] +WHERE <replaceable class="PARAMETER">expr</replaceable> <replaceable class="PARAMETER">ETER">c</replaceable>e<replaceable class="PARAMETER">"PAR</replaceable>replaceable> [ <replaceable class="PARAMETER">log_op</replaceable> ... ] </synopsis> where <replaceable class="PARAMETER">cond_op</replaceable> can be @@ -294,7 +287,7 @@ class="PARAMETER">log_op</replaceable> ... ] <refsect2info> <date>1998-09-24</date> </refsect2info> - <title> + <title id="group-by-title"> GROUP BY Clause </title> <para> @@ -302,19 +295,24 @@ class="PARAMETER">log_op</replaceable> ... ] of this clause: <synopsis> GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...] - </synopsis></para> - <para> - GROUP BY will condense into a single row all rows that share the same values for the - grouped columns; aggregates return values derived from all rows that make up the group. The value returned for an ungrouped - and unaggregated column is dependent on the order in which rows happen to be read from the database. - </para> -</refsect2> - + </synopsis> + </para> + + <para> + GROUP BY will condense into a single row all rows that share the + same values for the + grouped columns; aggregates return values derived from all rows + that make up the group. The value returned for an ungrouped + and unaggregated column is dependent on the order in which rows + happen to be read from the database. + </para> + </refsect2> + <refsect2 id="R2-SQL-HAVING-2"> <refsect2info> <date>1998-09-24</date> </refsect2info> - <title> + <title id="having-title"> HAVING Clause </title> <para> @@ -325,16 +323,17 @@ HAVING <replaceable class="PARAMETER">cond_expr</replaceable> </synopsis> where <replaceable class="PARAMETER">cond_expr</replaceable> is the same - as specified for the WHERE clause.</para> + as specified for the WHERE clause. + </para> <para> HAVING specifies a grouped table derived by the elimination of groups from the result of the previously specified clause that do not meet the <replaceable class="PARAMETER">cond_expr</replaceable>.</para> - + <para> Each column referenced in -<replaceable class="PARAMETER">cond_expr</replaceable> shall unambiguously + <replaceable class="PARAMETER">cond_expr</replaceable> shall unambiguously reference a grouping column. </para> </refsect2> @@ -343,7 +342,7 @@ HAVING <replaceable class="PARAMETER">cond_expr</replaceable> <refsect2info> <date>1998-09-24</date> </refsect2info> - <title> + <title id="order-by-title"> ORDER BY Clause </title> <para> @@ -353,7 +352,8 @@ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, . <para> <replaceable class="PARAMETER">column</replaceable> can be either a column - name or an ordinal number.</para> + name or an ordinal number. + </para> <para> The ordinal numbers refers to the ordinal (left-to-right) position of the column. This feature makes it possible to define an ordering @@ -366,130 +366,136 @@ SELECT title, date_prod + 1 AS newlen FROM films ORDER BY newlen; </programlisting></para> <para> - From release 6.4 of PostgreSQL, the columns in the ORDER BY clause do not need to appear in the SELECT clause. + From release 6.4 of PostgreSQL, the columns in the ORDER BY clause + do not need to appear in the SELECT clause. Thus the following statement is now legal: <programlisting> SELECT name FROM distributors ORDER BY code; - </programlisting></para> + </programlisting> + </para> <para> Optionally one may add the keyword DESC (descending) or ASC (ascending) after each column name in the ORDER BY clause. - If not specified, ASC is assumed by default.</para> + If not specified, ASC is assumed by default. + </para> </refsect2> <refsect2 id="R2-SQL-UNION-2"> <refsect2info> <date>1998-09-24</date> </refsect2info> - <title> + <title id="union-title"> UNION Clause </title> <para> <synopsis> -<replaceable class="PARAMETER">table_query</replaceable> UNION [ ALL ] -<replaceable class="PARAMETER">table_query</replaceable> - [ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ] +<replaceable class="PARAMETER">table_query</replaceable> UNION [ ALL ] <replaceable class="PARAMETER">table_query</replaceable> + [ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ] </synopsis> - + where <replaceable class="PARAMETER">table_query</replaceable> - specifies any select expression without an ORDER BY clause.</para> + specifies any select expression without an ORDER BY clause. + </para> <para> The UNION clause allows the result to be the collection of rows returned by the queries involved. (See UNION clause). The two tables that represent the direct operands of the UNION must have the same number of columns, and corresponding columns must be - of compatible data types.</para> + of compatible data types. + </para> <para> By default, the result of UNION does not contain any duplicate rows - unless the ALL clause is specified.</para> + unless the ALL clause is specified. + </para> <para> Multiple UNION operators in the same SELECT statement are evaluated left to right. Note that the ALL keyword is not global in nature, being - applied only for the current pair of table results.</para> - + applied only for the current pair of table results. + </para> + </refsect2> <refsect2 id="R2-SQL-INTERSECT-2"> <refsect2info> <date>1998-09-24</date> </refsect2info> - <title> + <title id="intersect-title"> INTERSECT Clause </title> <para> <synopsis> -<replaceable class="PARAMETER">table_query</replaceable> INTERSECT -<replaceable class="PARAMETER">table_query</replaceable> - [ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ] +<replaceable class="PARAMETER">table_query</replaceable> INTERSECT <replaceable class="PARAMETER">table_query</replaceable> + [ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ] </synopsis> where <replaceable class="PARAMETER">table_query</replaceable> - specifies any select expression without an ORDER BY clause.</para> - + specifies any select expression without an ORDER BY clause. + </para> + <para> The INTERSECT clause allows the result to be all rows that are - common to the involved queries. (See INTERSECT clause). + common to the involved queries. The two tables that represent the direct operands of the INTERSECT must have the same number of columns, and corresponding columns must be - of compatible data types.</para> + of compatible data types. + </para> <para> Multiple INTERSECT operators in the same SELECT statement are evaluated left to right. - </para> - + </para> </refsect2> <refsect2 id="R2-SQL-EXCEPT-2"> <refsect2info> <date>1998-09-24</date> </refsect2info> - <title> + <title id="except-title"> EXCEPT Clause </title> <para> <synopsis> -<replaceable class="PARAMETER">table_query</replaceable> EXCEPT - <replaceable class="PARAMETER">table_query</replaceable> +<replaceable class="PARAMETER">table_query</replaceable> EXCEPT <replaceable class="PARAMETER">table_query</replaceable> [ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ] </synopsis> where <replaceable class="PARAMETER">table_query</replaceable> - specifies any select expression without an ORDER BY clause.</para> - + specifies any select expression without an ORDER BY clause. + </para> + <para> The EXCEPT clause allows the result to be rows from the upper query that are not in the lower query. (See EXCEPT clause). The two tables that represent the direct operands of the EXCEPT must have the same number of columns, and corresponding columns must be - of compatible data types.</para> - + of compatible data types. + </para> + <para> Multiple EXCEPT operators in the same SELECT statement are evaluated left to right. - </para> - + </para> </refsect2> + </refsect1> -</refsect1> - <refsect1 id="R1-SQL-SELECT-2"> <title> Usage </title> + <para> To join the table <literal>films</literal> with the table <literal>distributors</literal>: - </para> - <programlisting> + + <programlisting> SELECT f.title, f.did, d.name, f.date_prod, f.kind FROM distributors d, films f WHERE f.did = d.did @@ -513,12 +519,14 @@ Storia di una donna |108|Westward |1970-08-15|Romantic The King and I |109|20th Century Fox|1956-08-11|Musical Das Boot |110|Bavaria Atelier |1981-11-11|Drama Bed Knobs and Broomsticks|111|Walt Disney | |Musical - </programlisting> + </programlisting> + </para> + <para> To sum the column <literal>len</literal> of all films and group the results by <literal>kind</literal>: - </para> - <programlisting> + + <programlisting> SELECT kind, SUM(len) AS total FROM films GROUP BY kind; kind |total @@ -528,14 +536,15 @@ SELECT kind, SUM(len) AS total FROM films GROUP BY kind; Drama | 14:28 Musical | 06:42 Romantic | 04:38 - </programlisting> + </programlisting> + </para> <para> To sum the column <literal>len</literal> of all films, group the results by <literal>kind</literal> and show those group totals that are less than 5 hours: - </para> - <programlisting> + + <programlisting> SELECT kind, SUM(len) AS total FROM films GROUP BY kind @@ -545,13 +554,15 @@ SELECT kind, SUM(len) AS total ----------+------ Comedy | 02:58 Romantic | 04:38 - </programlisting> + </programlisting> + </para> + <para> - The following two examples are identical ways of sorting the individual + The following two examples are identical ways of sorting the individual results according to the contents of the second column (<literal>name</literal>): - </para> - <programlisting> + + <programlisting> SELECT * FROM distributors ORDER BY name; SELECT * FROM distributors ORDER BY 2; @@ -570,7 +581,8 @@ SELECT * FROM distributors ORDER BY 2; 111|Walt Disney 112|Warner Bros. 108|Westward - </programlisting> + </programlisting> + </para> <para> This example shows how to obtain the union of the tables @@ -578,8 +590,8 @@ SELECT * FROM distributors ORDER BY 2; <literal>actors</literal>, restricting the results to those that begin with letter W in each table. Only distinct rows are to be used, so the ALL keyword is omitted: - </para> - <programlisting> + + <programlisting> -- distributors: actors: -- did|name id|name -- ---+------------ --+-------------- @@ -604,8 +616,8 @@ Warner Bros. Warren Beatty Westward Woody Allen - </programlisting> - + </programlisting> + </para> </refsect1> <refsect1 id="R1-SQL-SELECT-3"> @@ -705,7 +717,7 @@ SELECT distributors.* WHERE name = 'Westwood'; <!-- Keep this comment at the end of the file Local variables: mode: sgml -sgml-omittag: +sgml-omittag:nil sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t diff --git a/doc/src/sgml/ref/select_into.sgml b/doc/src/sgml/ref/select_into.sgml index ca9958ea05d..20c5312dae6 100644 --- a/doc/src/sgml/ref/select_into.sgml +++ b/doc/src/sgml/ref/select_into.sgml @@ -1,16 +1,16 @@ <refentry id="SQL-SELECTINTO"> <refmeta> <refentrytitle> -SELECT INTO + SELECT INTO </refentrytitle> <refmiscinfo>SQL - Language Statements</refmiscinfo> </refmeta> <refnamediv> <refname> -SELECT INTO + SELECT INTO </refname> <refpurpose> -Create a new table from an existing table or view + Create a new table from an existing table or view </refpurpose></refnamediv> <refsynopsisdiv> <refsynopsisdivinfo> @@ -37,7 +37,8 @@ SELECT [ ALL | DISTINCT ] <replaceable class="PARAMETER">expression</replaceable Inputs </title> <para> -All input fields are described in detail for SELECT. + All input fields are described in detail for + <xref linkend="select-title" endterm="select-title">. </para> </refsect2> @@ -49,7 +50,8 @@ All input fields are described in detail for SELECT. Outputs </title> <para> -All output fields are described in detail for SELECT. + All output fields are described in detail for + <xref linkend="select-title" endterm="select-title">. </para> </refsect2> </refsynopsisdiv> @@ -62,12 +64,14 @@ All output fields are described in detail for SELECT. Description </title> <para> - SELECT INTO creates a new table from the results of a query. Typically, this + <command>SELECT INTO</command> creates a new table from the results + of a query. Typically, this query draws data from an existing table, but any SQL query is allowed. + <note> - <para> - CREATE TABLE AS is functionally equivalent to the SELECT INTO command. - </para> + <para> + CREATE TABLE AS is functionally equivalent to the SELECT INTO command. + </para> </note> </para> </refsect1> @@ -76,7 +80,7 @@ All output fields are described in detail for SELECT. <!-- Keep this comment at the end of the file Local variables: mode: sgml -sgml-omittag: +sgml-omittag:nil sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml index af71daf5321..3820ba70817 100644 --- a/doc/src/sgml/ref/set.sgml +++ b/doc/src/sgml/ref/set.sgml @@ -201,9 +201,9 @@ default Setting the <envar>PGDATESTYLE</envar> environment variable. </member> <member> - Running postmaster using the <option>-oe</option> parameter to set + Running postmaster using the option <option>-o -e</option> to set dates to the <literal>European</literal> convention. - Note that this affects only the some combinations of date styles; for example + Note that this affects only some combinations of date styles; for example the ISO style is not affected by this parameter. </member> <member> diff --git a/doc/src/sgml/ref/show.sgml b/doc/src/sgml/ref/show.sgml index 45dd3800d75..e19a8cf0e84 100644 --- a/doc/src/sgml/ref/show.sgml +++ b/doc/src/sgml/ref/show.sgml @@ -18,7 +18,7 @@ <date>1998-09-24</date> </refsynopsisdivinfo> <synopsis> -SHOW <replaceable class="PARAMETER">variable</replaceable> +SHOW <replaceable class="PARAMETER">keyword</replaceable> </synopsis> <refsect2 id="R2-SQL-SHOW-1"> @@ -28,17 +28,15 @@ SHOW <replaceable class="PARAMETER">variable</replaceable> <title> Inputs </title> - <para> + <para> <variablelist> <varlistentry> - <term> - <replaceable class="PARAMETER">variable</replaceable> - </term> + <term><replaceable class="PARAMETER">keyword</replaceable></term> <listitem> <para> Refer to <command>SET</command> for more information on available - variables. + arguments. </para> </listitem> </varlistentry> @@ -53,40 +51,40 @@ SHOW <replaceable class="PARAMETER">variable</replaceable> <title> Outputs </title> - <para> + <para> <variablelist> <varlistentry> - <term> - <returnvalue>NOTICE: <replaceable - class="PARAMETER">">variab</replaceable>E> is <replaceable>value</replaceable></returnvalue> - SHOW VARIABLE - </term> + <term><computeroutput> +NOTICE: <replaceable class="PARAMETER">variable</replaceable> is <replaceable>value</replaceable> +SHOW VARIABLE + </computeroutput></term> <listitem> <para> - Message returned if successfully. + Message returned if successful. </para> </listitem> </varlistentry> <varlistentry> - <term> - <returnvalue>NOTICE: Unrecognized variable <replaceable>value</replaceable></returnvalue> - </term> + <term><computeroutput> +NOTICE: Unrecognized variable <replaceable>value</replaceable> + </computeroutput></term> <listitem> <para> Message returned if <returnvalue>value</returnvalue> does not exist. </para> </listitem> </varlistentry> - + <varlistentry> - <term> - NOTICE: Time zone is unknown - SHOW VARIABLE - </term> + <term><computeroutput> +NOTICE: Time zone is unknown +SHOW VARIABLE + </computeroutput></term> <listitem> <para> - If the TZ environment variable is not set. + If the <envar>TZ</envar> or <envar>PGTZ</envar> environment + variable is not set. </para> </listitem> </varlistentry> @@ -138,12 +136,17 @@ SHOW <replaceable class="PARAMETER">variable</replaceable> Usage </title> <para> + Show the current <literal>DateStyle</literal> setting: + <programlisting> --- show DateStyle; SHOW DateStyle; NOTICE:DateStyle is Postgres with US (NonEuropean) conventions + </programlisting> + </para> --- show Geqo; + <para> + Show the current genetic optimizer (<literal>geqo</literal>) setting: + <programlisting> SHOW GEQO; NOTICE:GEQO is ON </programlisting> @@ -183,7 +186,7 @@ sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../reference.ced" sgml-exposed-tags:nil -sgml-local-catalogs:"/usr/lib/sgml/CATALOG" +sgml-local-catalogs:"/usr/lib/sgml/catalog" sgml-local-ecat-files:nil End: --> diff --git a/doc/src/sgml/ref/unlisten.sgml b/doc/src/sgml/ref/unlisten.sgml index 5f37388d66c..51e5c0c93ac 100644 --- a/doc/src/sgml/ref/unlisten.sgml +++ b/doc/src/sgml/ref/unlisten.sgml @@ -1,178 +1,197 @@ -<REFENTRY ID="SQL-UNLISTEN"> -<REFMETA> -<REFENTRYTITLE> -UNLISTEN -</REFENTRYTITLE> -<REFMISCINFO>SQL - Language Statements</REFMISCINFO> -</REFMETA> -<REFNAMEDIV> -<REFNAME> -UNLISTEN -</REFNAME> -<REFPURPOSE> -Stop listening for notification -</REFPURPOSE> -</refnamediv> -<REFSYNOPSISDIV> -<REFSYNOPSISDIVINFO> -<DATE>1998-10-19</DATE> -</REFSYNOPSISDIVINFO> -<SYNOPSIS> -UNLISTEN { <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> | * } -</SYNOPSIS> - -<REFSECT2 ID="R2-SQL-UNLISTEN-1"> -<REFSECT2INFO> -<DATE>1998-10-19</DATE> -</REFSECT2INFO> -<TITLE> -Inputs -</TITLE> -<PARA> -</PARA> -<VARIABLELIST> -<VARLISTENTRY> -<TERM> -<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> -</TERM> -<LISTITEM> -<PARA> -Name of previously registered notify condition. -</para> -</listitem> -</varlistentry> -<VARLISTENTRY> -<TERM> -<literal>*</literal> -</TERM> -<LISTITEM> -<PARA> -All current listen registrations for this backend are cleared. -</para> -</listitem> -</varlistentry> - -</VARIABLELIST> - -</REFSECT2> - -<REFSECT2 ID="R2-SQL-UNLISTEN-2"> -<REFSECT2INFO> -<DATE>1998-10-19</DATE> -</REFSECT2INFO> -<TITLE> -Outputs -</TITLE> -<PARA> - -<VARIABLELIST> -<VARLISTENTRY> -<TERM> +<refentry id="SQL-UNLISTEN"> + <refmeta> + <refentrytitle> + UNLISTEN + </refentrytitle> + <refmiscinfo>SQL - Language Statements</refmiscinfo> + </refmeta> + <refnamediv> + <refname> + UNLISTEN + </refname> + <refpurpose> + Stop listening for notification + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsynopsisdivinfo> + <date>1998-10-19</date> + </refsynopsisdivinfo> + <synopsis> +UNLISTEN { <replaceable class="PARAMETER">notifyname</replaceable> | * } + </synopsis> + + <refsect2 id="R2-SQL-UNLISTEN-1"> + <refsect2info> + <date>1998-10-19</date> + </refsect2info> + <title> + Inputs + </title> + + <para> + <variablelist> + <varlistentry> + <term><replaceable class="PARAMETER">notifyname</replaceable></term> + <listitem> + <para> + Name of previously registered notify condition. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><literal>*</literal></term> + <listitem> + <para> + All current listen registrations for this backend are cleared. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect2> + + <refsect2 id="R2-SQL-UNLISTEN-2"> + <refsect2info> + <date>1998-10-19</date> + </refsect2info> + <title> + Outputs + </title> + <para> + + <variablelist> + <varlistentry> + <term><computeroutput> <returnvalue>UNLISTEN</returnvalue> -</TERM> -<LISTITEM> -<PARA> -Acknowledgement that statement has executed. -</para> -</listitem> -</varlistentry> - -</VARIABLELIST> -</para> -</REFSECT2> -</REFSYNOPSISDIV> - -<REFSECT1 ID="R1-SQL-UNLISTEN-1"> -<REFSECT1INFO> -<DATE>1998-10-19</DATE> -</REFSECT1INFO> -<TITLE> -Description -</TITLE> -<PARA> -<command>UNLISTEN</command> -is used to remove an existing <command>NOTIFY</command> registration. -UNLISTEN cancels any existing registration of the current -<productname>Postgres</productname> session as a listener on the notify -condition <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>. -The special condition wildcard "*" cancels all listener registrations -for the current session. -</para> -<para> -<xref linkend="sql-notify" endterm="sql-notify-ref"> -contains a more extensive -discussion of the use of <command>LISTEN</command> and -<command>NOTIFY</command>. -</para> - -<REFSECT2 ID="R2-SQL-UNLISTEN-3"> -<REFSECT2INFO> -<DATE>1998-10-19</DATE> -</REFSECT2INFO> -<TITLE> -Notes -</TITLE> -<para> -<REPLACEABLE CLASS="PARAMETER">classname</REPLACEABLE> -needs not to be a valid class name but can be any string valid -as a name up to 32 characters long. -</para> -<para> -The backend does not complain if you UNLISTEN something you were not -listening for. -Each backend will automatically execute <command>UNLISTEN *</command> when -exiting. -</para> -<para> -A restriction in some previous releases of - <productname>Postgres</productname> that a -<REPLACEABLE CLASS="PARAMETER">classname</REPLACEABLE> -which does not correspond to an actual table must be enclosed in double-quotes -is no longer present. -</para> -</REFSECT2> -</refsect1> - -<REFSECT1 ID="R1-SQL-UNLISTEN-2"> -<TITLE> -Usage -</TITLE> - -<para> -<programlisting> + </computeroutput></term> + <listitem> + <para> + Acknowledgement that statement has executed. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect2> + </refsynopsisdiv> + + <refsect1 id="R1-SQL-UNLISTEN-1"> + <refsect1info> + <date>1998-10-19</date> + </refsect1info> + <title> + Description + </title> + + <para> + <command>UNLISTEN</command> + is used to remove an existing <command>NOTIFY</command> registration. + UNLISTEN cancels any existing registration of the current + <productname>Postgres</productname> session as a listener on the notify + condition <replaceable class="PARAMETER">notifyname</replaceable>. + The special condition wildcard "*" cancels all listener registrations + for the current session. + </para> + + <para> + <xref endterm="sql-notify-ref" linkend="sql-notify"> + contains a more extensive + discussion of the use of <command>LISTEN</command> and + <command>NOTIFY</command>. + </para> + + <refsect2 id="R2-SQL-UNLISTEN-3"> + <refsect2info> + <date>1998-10-19</date> + </refsect2info> + <title> + Notes + </title> + <para> + <replaceable class="PARAMETER">classname</replaceable> + needs not to be a valid class name but can be any string valid + as a name up to 32 characters long. + </para> + <para> + The backend does not complain if you UNLISTEN something you were not + listening for. + Each backend will automatically execute <command>UNLISTEN *</command> when + exiting. + </para> + <para> + A restriction in some previous releases of + <productname>Postgres</productname> that a + <replaceable class="PARAMETER">classname</replaceable> + which does not correspond to an actual table must be enclosed in double-quotes + is no longer present. + </para> + </refsect2> + </refsect1> + + <refsect1 id="R1-SQL-UNLISTEN-2"> + <title> + Usage + </title> + + <para> + To subscribe to an existing registration: + + <programlisting> postgres=> LISTEN virtual; LISTEN postgres=> NOTIFY virtual; NOTIFY ASYNC NOTIFY of 'virtual' from backend pid '12317' received -</programlisting> + </programlisting> + </para> -<programlisting> + <para> + Once UNLISTEN has been executed, further NOTIFY commands will be + ignored: + + <programlisting> postgres=> UNLISTEN virtual; UNLISTEN postgres=> NOTIFY virtual; NOTIFY -- notice no NOTIFY event is received -postgres=> -</programlisting> -</para> -</REFSECT1> - -<REFSECT1 ID="R1-SQL-UNLISTEN-3"> -<TITLE> -Compatibility -</TITLE> - -<REFSECT2 ID="R2-SQL-UNLISTEN-4"> -<REFSECT2INFO> -<DATE>1998-10-19</DATE> -</REFSECT2INFO> -<TITLE> -SQL92 -</TITLE> -<PARA> - There is no <command>UNLISTEN</command> in <acronym>SQL92</acronym>. -</para> -</refsect2> -</refsect1> -</REFENTRY> + </programlisting> + </para> + </refsect1> + + <refsect1 id="R1-SQL-UNLISTEN-3"> + <title> + Compatibility + </title> + + <refsect2 id="R2-SQL-UNLISTEN-4"> + <refsect2info> + <date>1998-10-19</date> + </refsect2info> + <title> + SQL92 + </title> + <para> + There is no <command>UNLISTEN</command> in <acronym>SQL92</acronym>. + </para> + </refsect2> + </refsect1> +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:nil +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../reference.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:"/usr/lib/sgml/catalog" +sgml-local-ecat-files:nil +End: +--> diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml index 6861c983f7d..7383e7de68b 100644 --- a/doc/src/sgml/ref/update.sgml +++ b/doc/src/sgml/ref/update.sgml @@ -1,163 +1,154 @@ -<REFENTRY ID="SQL-UPDATE"> -<REFMETA> -<REFENTRYTITLE> -UPDATE -</REFENTRYTITLE> -<REFMISCINFO>SQL - Language Statements</REFMISCINFO> -</REFMETA> -<REFNAMEDIV> -<REFNAME> -UPDATE -</REFNAME> -<REFPURPOSE> -Replaces values of columns in a table -</REFPURPOSE> -</refnamediv> -<REFSYNOPSISDIV> -<REFSYNOPSISDIVINFO> -<DATE>1998-09-24</DATE> -</REFSYNOPSISDIVINFO> -<SYNOPSIS> -UPDATE <REPLACEABLE CLASS="PARAMETER">table</replaceable> SET <REPLACEABLE CLASS="PARAMETER">column</replaceable> = <REPLACEABLE CLASS="PARAMETER">expression</replaceable> [, ...] - [ FROM <REPLACEABLE CLASS="PARAMETER">fromlist</REPLACEABLE> ] - [ WHERE <REPLACEABLE CLASS="PARAMETER">condition</REPLACEABLE> ] -</SYNOPSIS> - - <REFSECT2 ID="R2-SQL-UPDATE-1"> - <REFSECT2INFO> - <DATE>1998-09-24</DATE> - </REFSECT2INFO> - <TITLE> - Inputs - </TITLE> - <PARA> - - <VARIABLELIST> - <VARLISTENTRY> - <TERM> - <REPLACEABLE CLASS="PARAMETER">table</replaceable> - </TERM> - <LISTITEM> - <PARA> - The name of an existing table. - </para> - </LISTITEM> - </VARLISTENTRY> - <VARLISTENTRY> - <TERM> - <REPLACEABLE CLASS="PARAMETER">column</replaceable> - </TERM> - <LISTITEM> - <PARA> - The name of a column in <REPLACEABLE CLASS="PARAMETER">table</replaceable>. - </para> - </LISTITEM> - </VARLISTENTRY> - <VARLISTENTRY> - <TERM> - <REPLACEABLE CLASS="PARAMETER">expression</replaceable> - </TERM> - <LISTITEM> - <PARA> - A valid expression or value to assign to column. - </para> - </LISTITEM> - </VARLISTENTRY> - <VARLISTENTRY> - <TERM> - <REPLACEABLE CLASS="PARAMETER">fromlist</REPLACEABLE> - </TERM> - <LISTITEM> - <PARA> - A <productname>Postgres</productname> - non-standard extension to allow columns - from other tables to appear in the WHERE condition. - </para> - </LISTITEM> - </VARLISTENTRY> - <VARLISTENTRY> - <TERM> - <REPLACEABLE CLASS="PARAMETER">condition</REPLACEABLE> - </TERM> - <LISTITEM> - <PARA> - Refer to the SELECT statement for a further description - of the WHERE clause. - </para> - </LISTITEM> - </VARLISTENTRY> - </VARIABLELIST> - </para> - </REFSECT2> - - <REFSECT2 ID="R2-SQL-UPDATE-2"> - <REFSECT2INFO> - <DATE>1998-09-24</DATE> - </REFSECT2INFO> - <TITLE> - Outputs - </TITLE> - <PARA> - - <VARIABLELIST> - <VARLISTENTRY> - <TERM> - UPDATE <replaceable class="parameter">#</replaceable> - </TERM> - <LISTITEM> - <PARA> - Message returned if successful. - The <replaceable class="parameter">#</replaceable> - means the number of rows updated. - If <replaceable class="parameter">#</replaceable> - is equal 0 no rows are updated. - </para> - </LISTITEM> - </VARLISTENTRY> - </VARIABLELIST> - </para> - </REFSECT2> - </REFSYNOPSISDIV> - - <REFSECT1 ID="R1-SQL-UPDATE-1"> - <REFSECT1INFO> - <DATE>1998-09-24</DATE> - </REFSECT1INFO> - <TITLE> - Description - </TITLE> - <PARA> - UPDATE changes the values of the columns specified for - all rows which satisfy condition. Only the columns - to be modified need appear as column. - </para> - <PARA> - Array references use the same syntax found in SELECT. - That is, either single array elements, a range of array - elements or the entire array may be replaced with a single - query. - </para> - <PARA> - You must have write access to the table in order to modify - it, as well as read access to any table whose values are - mentioned in the WHERE condition. - </para> - </REFSECT1> - - <REFSECT1 ID="R1-SQL-UPDATE-2"> - <TITLE> - Usage - </TITLE> - <PARA> - </PARA> - <ProgramListing> - --Change word "Drama" with "Dramatic" on column kind: - -- - UPDATE films - SET kind = 'Dramatic' - WHERE kind = 'Drama'; - - SELECT * FROM films WHERE kind = 'Dramatic' OR kind = 'Drama'; +<refentry id="SQL-UPDATE"> + <refmeta> + <refentrytitle> + UPDATE + </refentrytitle> + <refmiscinfo>SQL - Language Statements</refmiscinfo> + </refmeta> + <refnamediv> + <refname> + UPDATE + </refname> + <refpurpose> + Replaces values of columns in a table + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsynopsisdivinfo> + <date>1998-09-24</date> + </refsynopsisdivinfo> + <synopsis> +UPDATE <replaceable class="PARAMETER">table</replaceable> SET <replaceable class="PARAMETER">R">col</replaceable>le> = <replaceable class="PARAMETER">expression</replaceable> [, ...] + [ FROM <replaceable class="PARAMETER">fromlist</replaceable> ] + [ WHERE <replaceable class="PARAMETER">condition</replaceable> ] + </synopsis> + + <refsect2 id="R2-SQL-UPDATE-1"> + <refsect2info> + <date>1998-09-24</date> + </refsect2info> + <title> + Inputs + </title> + <para> + + <variablelist> + <varlistentry> + <term><replaceable class="PARAMETER">table</replaceable></term> + <listitem> + <para> + The name of an existing table. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><replaceable class="PARAMETER">column</replaceable></term> + <listitem> + <para> + The name of a column in <replaceable class="PARAMETER">table</replaceable>. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><replaceable class="PARAMETER">expression</replaceable></term> + <listitem> + <para> + A valid expression or value to assign to column. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><replaceable class="PARAMETER">fromlist</replaceable></term> + <listitem> + <para> + A <productname>Postgres</productname> + non-standard extension to allow columns + from other tables to appear in the WHERE condition. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><replaceable class="PARAMETER">condition</replaceable></term> + <listitem> + <para> + Refer to the SELECT statement for a further description + of the WHERE clause. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect2> + + <refsect2 id="R2-SQL-UPDATE-2"> + <refsect2info> + <date>1998-09-24</date> + </refsect2info> + <title> + Outputs + </title> + + <para> + <variablelist> + <varlistentry> + <term><computeroutput> +UPDATE <replaceable class="parameter">#</replaceable> + </computeroutput></term> + <listitem> + <para> + Message returned if successful. + The <replaceable class="parameter">#</replaceable> + means the number of rows updated. + If <replaceable class="parameter">#</replaceable> + is equal 0 no rows are updated. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect2> + </refsynopsisdiv> + + <refsect1 id="R1-SQL-UPDATE-1"> + <refsect1info> + <date>1998-09-24</date> + </refsect1info> + <title> + Description + </title> + <para> + <command>UPDATE</command> changes the values of the columns specified for + all rows which satisfy condition. Only the columns + to be modified need appear as column. + </para> + + <para> + Array references use the same syntax found in SELECT. + That is, either single array elements, a range of array + elements or the entire array may be replaced with a single + query. + </para> + + <para> + You must have write access to the table in order to modify + it, as well as read access to any table whose values are + mentioned in the WHERE condition. + </para> + </refsect1> + + <refsect1 id="R1-SQL-UPDATE-2"> + <title> + Usage + </title> + + <para> + Change word "Drama" with "Dramatic" on column kind: + + <programlisting> +UPDATE films + SET kind = 'Dramatic' + WHERE kind = 'Drama'; +SELECT * FROM films WHERE kind = 'Dramatic' OR kind = 'Drama'; code |title |did| date_prod|kind |len -----+-------------+---+----------+----------+------ @@ -166,35 +157,52 @@ UPDATE <REPLACEABLE CLASS="PARAMETER">table</replaceable> SET <REPLACEABLE CLASS M_401|War and Peace|104|1967-02-12|Dramatic | 05:57 T_601|Yojimbo |106|1961-06-16|Dramatic | 01:50 DA101|Das Boot |110|1981-11-11|Dramatic | 02:29 - </ProgramListing> - - </REFSECT1> - - <REFSECT1 ID="R1-SQL-UPDATE-3"> - <TITLE> - Compatibility - </TITLE> - <PARA> - </PARA> - - <REFSECT2 ID="R2-SQL-UPDATE-4"> - <REFSECT2INFO> - <DATE>1998-09-24</DATE> - </REFSECT2INFO> - <TITLE> - SQL92 - </TITLE> - <PARA> - SQL92 defines a different syntax for positioned UPDATE statement: - - <programlisting> - UPDATE table SET column = expression [, ...] - WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable> - </programlisting> - - where <replaceable class="parameter">cursor</replaceable> - identifies an open cursor. - </para> - </refsect2> - </refsect1> -</REFENTRY> + </programlisting> + </para> + </refsect1> + + <refsect1 id="R1-SQL-UPDATE-3"> + <title> + Compatibility + </title> + <para> + </para> + + <refsect2 id="R2-SQL-UPDATE-4"> + <refsect2info> + <date>1998-09-24</date> + </refsect2info> + <title> + SQL92 + </title> + <para> + SQL92 defines a different syntax for positioned UPDATE statement: + + <synopsis> +UPDATE table SET column = expression [, ...] + WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable> + </synopsis> + + where <replaceable class="parameter">cursor</replaceable> + identifies an open cursor. + </para> + </refsect2> + </refsect1> +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:nil +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../reference.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:"/usr/lib/sgml/catalog" +sgml-local-ecat-files:nil +End: +--> diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index 98758c773ee..2e9a3fe6531 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -1,212 +1,206 @@ -<REFENTRY ID="SQL-VACUUM-1"> -<REFMETA> -<REFENTRYTITLE id="vacuum"> -VACUUM -</REFENTRYTITLE> -<REFMISCINFO>SQL - Language Statements</REFMISCINFO> -</REFMETA> -<REFNAMEDIV> -<REFNAME> -VACUUM -</REFNAME> -<REFPURPOSE> -Clean and analyze a <productname>Postgres</productname> database -</REFPURPOSE> - </refnamediv> -<REFSYNOPSISDIV> -<REFSYNOPSISDIVINFO> -<DATE>1998-10-04</DATE> -</REFSYNOPSISDIVINFO> -<SYNOPSIS> -VACUUM [ VERBOSE ] [ ANALYZE ] [ <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ] -VACUUM [ VERBOSE ] ANALYZE [ <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [ (<REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...] ) ] ] -</SYNOPSIS> +<refentry id="SQL-VACUUM-1"> + <refmeta> + <refentrytitle id="vacuum"> + VACUUM + </refentrytitle> + <refmiscinfo>SQL - Language Statements</refmiscinfo> + </refmeta> + <refnamediv> + <refname> + VACUUM + </refname> + <refpurpose> + Clean and analyze a <productname>Postgres</productname> database + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <refsynopsisdivinfo> + <date>1998-10-04</date> + </refsynopsisdivinfo> + <synopsis> +VACUUM [ VERBOSE ] [ ANALYZE ] [ <replaceable class="PARAMETER">table</replaceable> ] +VACUUM [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">ER">t</replaceable>BLE> [ (<replaceable class="PARAMETER">column</replaceable> [, ...] ) ] ] + </synopsis> + + <refsect2 id="R2-SQL-VACUUM-1"> + <refsect2info> + <date>1998-10-04</date> + </refsect2info> + <title> + Inputs + </title> + + <para> + <variablelist> + <varlistentry> + <term>VERBOSE</term> + <listitem> + <para> + Prints a detailed vacuum activity report for each table. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>ANALYZE</term> + <listitem> + <para> + Updates column statistics used by the optimizer to + determine the most efficient way to execute a query. + The statistics represent the disbursion of the data in each column. + This information is valuable when several execution paths are possible. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><replaceable class="PARAMETER">table</replaceable></term> + <listitem> + <para> + The name of a specific table to vacuum. Defaults to all tables. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><replaceable class="PARAMETER">column</replaceable></term> + <listitem> + <para> + The name of a specific column to analyze. Defaults to all columns. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect2> + + <refsect2 id="R2-SQL-VACUUM-2"> + <refsect2info> + <date>1998-10-04</date> + </refsect2info> + <title> + Outputs + </title> + <para> + + <variablelist> + <varlistentry> + <term><computeroutput> +<returnvalue>VACUUM</returnvalue> + </computeroutput></term> + <listitem> + <para> + The command has been accepted and the database is being cleaned. + </para> + </listitem> + </varlistentry> - <REFSECT2 ID="R2-SQL-VACUUM-1"> - <REFSECT2INFO> - <DATE>1998-10-04</DATE> - </REFSECT2INFO> - <TITLE> - Inputs - </TITLE> - <PARA> - - <VARIABLELIST> - <VARLISTENTRY> - <TERM> - VERBOSE - </term> - <LISTITEM> - <PARA> - Prints a detailed vacuum activity report for each table. - </para> - </listitem> - </varlistentry> - <VARLISTENTRY> - <TERM> - ANALYZE - </term> - <LISTITEM> - <PARA> - Updates column statistics used by the optimizer to - determine the most efficient way to execute a query. - The statistics represent the disbursion of the data in each column. - This information is valuable when several execution paths are possible. - </para> - </listitem> - </varlistentry> - <VARLISTENTRY> - <TERM> - <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> - </term> - <LISTITEM> - <PARA> - The name of a specific table to vacuum. Defaults to all tables. - </para> - </listitem> - </varlistentry> - <VARLISTENTRY> - <TERM> - <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> - </term> - <LISTITEM> - <PARA> - The name of a specific column to analyze. Defaults to all columns. - </para> - </listitem> - </varlistentry> - </VARIABLELIST> - </para> - </REFSECT2> + <varlistentry> + <term><computeroutput> +NOTICE: --Relation <replaceable class="PARAMETER">table</replaceable>-- + </computeroutput></term> + <listitem> + <para> + The report header for <replaceable class="PARAMETER">table</replaceable>. + </para> + </listitem> + </varlistentry> - <REFSECT2 ID="R2-SQL-VACUUM-2"> - <REFSECT2INFO> - <DATE>1998-10-04</DATE> - </REFSECT2INFO> - <TITLE> - Outputs - </TITLE> - <PARA> + <varlistentry> + <term><computeroutput> +NOTICE: Pages 98: Changed 25, Reapped 74, Empty 0, New 0; + Tup 1000: Vac 3000, Crash 0, UnUsed 0, MinLen 188, MaxLen 188; + Re-using: Free/Avail. Space 586952/586952; EndEmpty/Avail. Pages 0/74. + Elapsed 0/0 sec. + </computeroutput></term> + <listitem> + <para> + The analysis for <replaceable class="PARAMETER">table</replaceable> itself. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><computeroutput> +NOTICE: Index <replaceable class="PARAMETER">index</replaceable>: Pages 28; + Tuples 1000: Deleted 3000. Elapsed 0/0 sec. + </computeroutput></term> + <listitem> + <para> + The analysis for an index on the target table. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect2> + </refsynopsisdiv> - <VARIABLELIST> - <VARLISTENTRY> - <TERM> - <ReturnValue>VACUUM</ReturnValue> - </TERM> - <LISTITEM> - <PARA> - The command has been accepted and the database is being cleaned. - </para> - </listitem> - </varlistentry> - - <VARLISTENTRY> - <TERM> - NOTICE: --Relation <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>-- - </term> - <LISTITEM> - <PARA> - The report header for <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>. - </para> - </listitem> - </varlistentry> + <refsect1 id="R1-SQL-VACUUM-1"> + <refsect1info> + <date>1998-10-04</date> + </refsect1info> + <title> + Description + </title> + <para> + <command>VACUUM</command> serves two purposes in + <productname>Postgres</productname> as both a means to reclaim storage and + also a means to collect information for the optimizer. + </para> - <VARLISTENTRY> - <TERM> - NOTICE: Pages 98: Changed 25, Reapped 74, Empty 0, New 0; - Tup 1000: Vac 3000, Crash 0, UnUsed 0, MinLen 188, MaxLen 188; - Re-using: Free/Avail. Space 586952/586952; EndEmpty/Avail. Pages 0/74. - Elapsed 0/0 sec. - </term> - <LISTITEM> - <PARA> - The analysis for <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> itself. - </para> - </listitem> - </varlistentry> - - <VARLISTENTRY> - <TERM> - NOTICE: Index <REPLACEABLE CLASS="PARAMETER">index</REPLACEABLE>: Pages 28; - Tuples 1000: Deleted 3000. Elapsed 0/0 sec. - </term> - <LISTITEM> - <PARA> - The analysis for an index on the target table. - </para> - </listitem> - </varlistentry> - </VARIABLELIST> - </para> - </REFSECT2> - </REFSYNOPSISDIV> + <para> + <command>VACUUM</command> opens every class in the database, + cleans out records from rolled back transactions, and updates statistics in the + system catalogs. The statistics maintained include the number of + tuples and number of pages stored in all classes. + </para> - <REFSECT1 ID="R1-SQL-VACUUM-1"> - <REFSECT1INFO> - <DATE>1998-10-04</DATE> - </REFSECT1INFO> - <TITLE> - Description - </TITLE> - <PARA> - <command>VACUUM</command> serves two purposes in - <productname>Postgres</productname> as both a means to reclaim storage and - also a means to collect information for the optimizer. - </para> - <para> - <command>VACUUM</command> opens every class in the database, - cleans out records from rolled back transactions, and updates statistics in the - system catalogs. The statistics maintained include the number of - tuples and number of pages stored in all classes. + <para> + Running <command>VACUUM</command> + periodically will increase the speed of the database in processing user queries. + </para> - Running <command>VACUUM</command> - periodically will increase the speed of the database in processing user queries. - </para> + <refsect2 id="R2-SQL-VACUUM-3"> + <refsect2info> + <date>1998-10-04</date> + </refsect2info> + <title> + Notes + </title> + <para> + The open database is the target for <command>VACUUM</command>. + </para> + <para> + We recommend that active production databases be cleaned nightly, in order + to keep statistics relatively current. The <command>VACUUM</command> + query may be executed at any time, however. In particular, after + copying a large class into <productname>Postgres</productname> + or after deleting a large number of + records, it may be a good idea to issue a <command>VACUUM</command> + query. This will update the system catalogs with the results of all + recent changes, and allow the <productname>Postgres</productname> + query optimizer to make better choices in planning user queries. + </para> + <para> + If the server crashes during a <command>VACUUM</command> command, + chances are it will leave a lock file hanging around. + Attempts to re-run the <command>VACUUM</command> command + result in an error message about the creation of a lock file. If you + are sure <command>VACUUM</command> is not running, + remove the <filename>pg_vlock</filename> file in your + database directory + (i.e. <filename><envar>PGDATA</envar>/base/dbname/pg_vlock</filename>). + </para> + </refsect2> + </refsect1> - <REFSECT2 ID="R2-SQL-VACUUM-3"> - <REFSECT2INFO> - <DATE>1998-10-04</DATE> - </REFSECT2INFO> - <TITLE> - Notes - </TITLE> - <PARA> - The open database is target for <command>VACUUM</command>. - </para> - <para> - We recommend that active production databases be cleaned nightly, in order - to keep statistics relatively current. The <command>VACUUM</command> - query may be executed at any time, however. In particular, after - copying a large class into <productname>Postgres</productname> - or after deleting a large number of - records, it may be a good idea to issue a <command>VACUUM</command> - query. This will update the system catalogs with the results of all - recent changes, and allow the <productname>Postgres</productname> - query optimizer to make better choices in planning user queries. - </para> - <para> - If the server crashes during a <command>VACUUM</command> command, - chances are it will leave a lock file hanging around. - Attempts to re-run the <command>VACUUM</command> command - result in an error message about the creation of a lock file. If you - are sure <command>VACUUM</command> is not running, - remove the <filename>pg_vlock</filename> file in your - database directory - (i.e. <filename><envar>PGDATA</envar>/base/dbname/pg_vlock</filename>). - </PARA> - - </REFSECT2> - </refsect1> + <refsect1 id="R1-SQL-VACUUM-2"> + <title> + Usage + </title> + <para> + The following is an example from running <command>VACUUM</command> on a table + in the regression database: - <REFSECT1 ID="R1-SQL-VACUUM-2"> - <TITLE> - Usage - </TITLE> - <PARA> - The following is an example from running <command>VACUUM</command> on a table - in the regression database: - - <ProgramListing> + <programlisting> regression=> vacuum verbose analyze onek; NOTICE: --Relation onek-- NOTICE: Pages 98: Changed 25, Reapped 74, Empty 0, New 0; @@ -223,24 +217,41 @@ NOTICE: Index onek_hundred: Pages 12; Tuples 1000: Deleted 1000. Elapsed 0/0 se NOTICE: Index onek_unique2: Pages 19; Tuples 1000: Deleted 1000. Elapsed 0/0 sec. NOTICE: Index onek_unique1: Pages 17; Tuples 1000: Deleted 1000. Elapsed 0/0 sec. VACUUM - </ProgramListing> - </para> - </REFSECT1> + </programlisting> + </para> + </refsect1> + + <refsect1 id="R1-SQL-VACUUM-3"> + <title> + Compatibility + </title> + <refsect2 id="R2-SQL-VACUUM-4"> + <refsect2info> + <date>1998-10-04</date> + </refsect2info> + <title> + SQL92 + </title> + <para> + There is no <command>VACUUM</command> statement in SQL92. + </para> + </refsect2> + </refsect1> +</refentry> - <REFSECT1 ID="R1-SQL-VACUUM-3"> - <TITLE> - Compatibility - </TITLE> - <REFSECT2 ID="R2-SQL-VACUUM-4"> - <REFSECT2INFO> - <DATE>1998-10-04</DATE> - </REFSECT2INFO> - <TITLE> - SQL92 - </TITLE> - <PARA> - There is no <COMMAND>VACUUM</COMMAND> statement in SQL92. - </para> - </refsect2> - </refsect1> -</REFENTRY> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:nil +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../reference.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:"/usr/lib/sgml/catalog" +sgml-local-ecat-files:nil +End: +--> diff --git a/doc/src/sgml/ref/vacuumdb.sgml b/doc/src/sgml/ref/vacuumdb.sgml index 8dad71bbdc8..55774395e3a 100644 --- a/doc/src/sgml/ref/vacuumdb.sgml +++ b/doc/src/sgml/ref/vacuumdb.sgml @@ -18,12 +18,9 @@ <date>1998-10-04</date> </refsynopsisdivinfo> <synopsis> -vacuumdb [ --analyze | -z ] [ --verbose | -v ] [ <replaceable - class="parameter">dbname</replaceable> ] -vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p - <replaceable class="parameter">port</replaceable> ] - [ --table '<replaceable class="parameter">table</replaceable> [ ( - <replaceable class="parameter">column</replaceable> [,...] ) ]' ] +vacuumdb [ --analyze | -z ] [ --verbose | -v ] [ <replaceable class="parameter">dbname</replaceable> ] +vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] + [ --table '<replaceable class="parameter">table</replaceable> [ ( <replaceable class="parameter">column</replaceable> [,...] ) ]' ] [ <replaceable class="parameter">dbname</replaceable> ] </synopsis> @@ -39,9 +36,7 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <variablelist> <varlistentry> - <term> - <replaceable class="parameter">dbname</replaceable> - </term> + <term><replaceable class="parameter">dbname</replaceable></term> <listitem> <para> Specifies the name of the database to be cleaned or analyzed. @@ -52,44 +47,30 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p </para> </listitem> </varlistentry> - + <varlistentry> - <term> - --analyze - </term> - <term> - -z - </term> + <term>--analyze</term> + <term>-z</term> <listitem> <para> Calculate statistics on the database for use by the optimizer. </para> </listitem> </varlistentry> - + <varlistentry> - <term> - --verbose - </term> - <term> - -v - </term> + <term>--verbose</term> + <term>-v</term> <listitem> <para> Print detailed information during processing. </para> </listitem> </varlistentry> - + <varlistentry> - <term> - --table <replaceable class="parameter">table</replaceable> [ - (<replaceable class="parameter">column</replaceable> [,...]) ] - </term> - <term> - -t <replaceable class="parameter">table</replaceable> [ - (<replaceable class="parameter">column</replaceable> [,...]) ] - </term> + <term>--table <replaceable class="parameter">table</replaceable> [ (<replaceable class="parameter">column</replaceable> [,...]) ]</term> + <term>-t <replaceable class="parameter">table</replaceable> [ (<replaceable class="parameter">column</replaceable> [,...]) ]</term> <listitem> <para> Clean or analyze <replaceable class="parameter">table</replaceable> only. @@ -98,18 +79,17 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p </para> </listitem> </varlistentry> - + </variablelist> </para> + <para> <application>vacuumdb</application> also accepts the following command line arguments for connection parameters: <variablelist> <varlistentry> - <term> - -h <replaceable class="parameter">host</replaceable> - </term> + <term>-h <replaceable class="parameter">host</replaceable></term> <listitem> <para> Specifies the hostname of the machine on which the @@ -119,11 +99,9 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p </para> </listitem> </varlistentry> - + <varlistentry> - <term> - -p <replaceable class="parameter">port</replaceable> - </term> + <term>-p <replaceable class="parameter">port</replaceable></term> <listitem> <para> Specifies the Internet TCP/IP port or local Unix domain socket file @@ -134,11 +112,9 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p </para> </listitem> </varlistentry> - + <varlistentry> - <term> - -u - </term> + <term>-u</term> <listitem> <para> Use password authentication. @@ -148,7 +124,6 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p </para> </listitem> </varlistentry> - </variablelist> </para> </refsect2> @@ -166,11 +141,10 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <variablelist> <varlistentry> - <term> - ERROR: Can't vacuum columns, only tables. You can 'vacuum analyze' columns. - vacuumdb: database vacuum failed on <replaceable - class="parameter">dbname</replaceable>. - </term> + <term><computeroutput> +ERROR: Can't vacuum columns, only tables. You can 'vacuum analyze' columns. +vacuumdb: database vacuum failed on <replaceable class="parameter">dbname</replaceable>. + </computeroutput></term> <listitem> <para> The non-analyze mode requires cleaning full tables or databases. @@ -180,11 +154,11 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p </varlistentry> <varlistentry> - <term> - Connection to database 'template1' failed. - connectDB() failed: Is the postmaster running and accepting connections - at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'? - </term> + <term><computeroutput> +Connection to database 'template1' failed. +connectDB() failed: Is the postmaster running and accepting connections +at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'? + </computeroutput></term> <listitem> <para> <application>vacuumdb</application> could not attach to the @@ -199,10 +173,10 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p </varlistentry> <varlistentry> - <term> - Connection to database '<replaceable class="parameter">dbname</replaceable>' failed. - FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow' - </term> + <term><computeroutput> +Connection to database '<replaceable class="parameter">dbname</replaceable>' failed. +FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow' + </computeroutput></term> <listitem> <para> You do not have a valid entry in the relation <literal>pg_shadow</literal> @@ -211,7 +185,6 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p </para> </listitem> </varlistentry> - </variablelist> </para> @@ -234,7 +207,7 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <title> Description </title> - + <para> <application>vacuumdb</application> is a utility for cleaning a <productname>Postgres</productname> database. @@ -250,7 +223,7 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <title> Notes </title> - + <para> See <xref endterm="vacuum" linkend="vacuum"> for more details. </para> @@ -267,22 +240,23 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p To clean a database of the same name as the user: <programlisting> - % vacuumdb +% vacuumdb </programlisting> </para> + <para> To analyze a database named <literal>bigdb</literal> for the optimizer: <programlisting> - % vacuumdb --analyze bigdb +% vacuumdb --analyze bigdb </programlisting> </para> <para> To analyze a single column <literal>bar</literal> in table <literal>foo</literal> in a database named <literal>xyzzy</literal> for the optimizer: - + <programlisting> - % vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy +% vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy </programlisting> </para> </refsect1> |