diff options
| author | Robert Haas <rhaas@postgresql.org> | 2010-01-22 16:40:19 +0000 |
|---|---|---|
| committer | Robert Haas <rhaas@postgresql.org> | 2010-01-22 16:40:19 +0000 |
| commit | 76a47c0e7423891d4b4f0977312f46fec6c5c416 (patch) | |
| tree | 8c9ad15f5c0bf5b2c129ec78fece1780eb430c0d /doc/src/sgml/ref | |
| parent | 9ca0989037602d9835eec04c2a9b6016a7b55740 (diff) | |
Replace ALTER TABLE ... SET STATISTICS DISTINCT with a more general mechanism.
Attributes can now have options, just as relations and tablespaces do, and
the reloptions code is used to parse, validate, and store them. For
simplicity and because these options are not performance critical, we store
them in a separate cache rather than the main relcache.
Thanks to Alex Hunsaker for the review.
Diffstat (limited to 'doc/src/sgml/ref')
| -rw-r--r-- | doc/src/sgml/ref/alter_table.sgml | 24 | ||||
| -rw-r--r-- | doc/src/sgml/ref/analyze.sgml | 4 |
2 files changed, 18 insertions, 10 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 354fa20edf7..7f4cb37e6e3 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.109 2009/09/18 05:00:41 petere Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.110 2010/01/22 16:40:18 rhaas Exp $ PostgreSQL documentation --> @@ -39,7 +39,8 @@ ALTER TABLE <replaceable class="PARAMETER">name</replaceable> ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> DROP DEFAULT ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET | DROP } NOT NULL ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STATISTICS <replaceable class="PARAMETER">integer</replaceable> - ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STATISTICS DISTINCT <replaceable class="PARAMETER">number</replaceable> + ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET ( <replaceable class="PARAMETER">attribute_option</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] ) + ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> RESET ( <replaceable class="PARAMETER">attribute_option</replaceable> [, ... ] ) ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } ADD <replaceable class="PARAMETER">table_constraint</replaceable> DROP CONSTRAINT [ IF EXISTS ] <replaceable class="PARAMETER">constraint_name</replaceable> [ RESTRICT | CASCADE ] @@ -158,14 +159,21 @@ ALTER TABLE <replaceable class="PARAMETER">name</replaceable> </varlistentry> <varlistentry> - <term><literal>SET STATISTICS DISTINCT</literal></term> + <term><literal>SET ( <replaceable class="PARAMETER">attribute_option</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] )</term></literal> + <term><literal>RESET ( <replaceable class="PARAMETER">attribute_option</replaceable> [, ... ] )</literal> <listitem> <para> - This form overrides the number-of-distinct-values estimate made by - subsequent <xref linkend="sql-analyze" endterm="sql-analyze-title"> - operations. When set to a positive value, <command>ANALYZE</> will - assume that the column contains exactly the specified number of distinct - nonnull values. When set to a negative value, which must be greater + This form sets or resets attribute-level options. Currently, the only + define attribute-level options are <literal>n_distinct</> and + <literal>n_distinct_inherited</>, which override the + number-of-distinct-values estimate made by subsequent + <xref linkend="sql-analyze" endterm="sql-analyze-title"> + operations. <literal>n_distinct</> affects the statistics for the table + itself, while <literal>n_distinct_inherited</> affects the statistics + gathered for the table and its inheritance children. When set to a + positive value, <command>ANALYZE</> will assume that the column contains + exactly the specified number of distinct nonnull values. When set to a + negative value, which must be greater than or equal to -1, <command>ANALYZE</> will assume that the number of distinct nonnull values in the column is linear in the size of the table; the exact count is to be computed by multiplying the estimated diff --git a/doc/src/sgml/ref/analyze.sgml b/doc/src/sgml/ref/analyze.sgml index cb9f20f3f56..7564ce1448e 100644 --- a/doc/src/sgml/ref/analyze.sgml +++ b/doc/src/sgml/ref/analyze.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/analyze.sgml,v 1.27 2009/08/04 22:04:37 petere Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/analyze.sgml,v 1.28 2010/01/22 16:40:18 rhaas Exp $ PostgreSQL documentation --> @@ -173,7 +173,7 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ ( <re with the largest possible statistics target. If this inaccuracy leads to bad query plans, a more accurate value can be determined manually and then installed with - <command>ALTER TABLE ... ALTER COLUMN ... SET STATISTICS DISTINCT</> + <command>ALTER TABLE ... ALTER COLUMN ... SET (n_distinct = ...)</> (see <xref linkend="sql-altertable" endterm="sql-altertable-title">). </para> </refsect1> |
