diff options
author | Simon Riggs | 2017-09-06 20:46:01 +0000 |
---|---|---|
committer | Simon Riggs | 2017-09-06 20:46:01 +0000 |
commit | 5b6d13eec72b960eb0f78542199380e49c8583d4 (patch) | |
tree | 8893caeb77015bb2502f3795954b6f59b5b04305 /doc/src | |
parent | e09db94c0a5f3b440d96c5c9e8e6c1638d1ec39f (diff) |
Allow SET STATISTICS on expression indexes
Index columns are referenced by ordinal number rather than name, e.g.
CREATE INDEX coord_idx ON measured (x, y, (z + t));
ALTER INDEX coord_idx ALTER COLUMN 3 SET STATISTICS 1000;
Incompatibility note for release notes:
\d+ for indexes now also displays Stats Target
Authors: Alexander Korotkov, with contribution by Adrien NAYRAT
Review: Adrien NAYRAT, Simon Riggs
Wordsmith: Simon Riggs
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/alter_index.sgml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/alter_index.sgml b/doc/src/sgml/ref/alter_index.sgml index ad77b5743ac..7d6553d2db1 100644 --- a/doc/src/sgml/ref/alter_index.sgml +++ b/doc/src/sgml/ref/alter_index.sgml @@ -26,6 +26,8 @@ ALTER INDEX [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> SET ALTER INDEX <replaceable class="PARAMETER">name</replaceable> DEPENDS ON EXTENSION <replaceable class="PARAMETER">extension_name</replaceable> ALTER INDEX [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> SET ( <replaceable class="PARAMETER">storage_parameter</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] ) ALTER INDEX [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> RESET ( <replaceable class="PARAMETER">storage_parameter</replaceable> [, ... ] ) +ALTER INDEX [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> ALTER [ COLUMN ] <replaceable class="PARAMETER">column_number</replaceable> + SET STATISTICS <replaceable class="PARAMETER">integer</replaceable> ALTER INDEX ALL IN TABLESPACE <replaceable class="PARAMETER">name</replaceable> [ OWNED BY <replaceable class="PARAMETER">role_name</replaceable> [, ... ] ] SET TABLESPACE <replaceable class="PARAMETER">new_tablespace</replaceable> [ NOWAIT ] </synopsis> @@ -110,6 +112,25 @@ ALTER INDEX ALL IN TABLESPACE <replaceable class="PARAMETER">name</replaceable> </listitem> </varlistentry> + <varlistentry> + <term><literal>ALTER [ COLUMN ] <replaceable class="PARAMETER">column_number</replaceable> SET STATISTICS <replaceable class="PARAMETER">integer</replaceable></literal></term> + <listitem> + <para> + This form sets the per-column statistics-gathering target for + subsequent <xref linkend="sql-analyze"> operations, though can + be used only on index columns that are defined as an expression. + Since expressions lack a unique name, we refer to them using the + ordinal number of the index column. + The target can be set in the range 0 to 10000; alternatively, set it + to -1 to revert to using the system default statistics + target (<xref linkend="guc-default-statistics-target">). + For more information on the use of statistics by the + <productname>PostgreSQL</productname> query planner, refer to + <xref linkend="planner-stats">. + </para> + </listitem> + </varlistentry> + </variablelist> </para> @@ -131,6 +152,16 @@ ALTER INDEX ALL IN TABLESPACE <replaceable class="PARAMETER">name</replaceable> </varlistentry> <varlistentry> + <term><replaceable class="PARAMETER">column_number</replaceable></term> + <listitem> + <para> + The ordinal number refers to the ordinal (left-to-right) position + of the index column. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><replaceable class="PARAMETER">name</replaceable></term> <listitem> <para> @@ -235,6 +266,14 @@ ALTER INDEX distributors SET (fillfactor = 75); REINDEX INDEX distributors; </programlisting></para> + <para> + Set the statistics-gathering target for an expression index: +<programlisting> +CREATE INDEX coord_idx ON measured (x, y, (z + t)); +ALTER INDEX coord_idx ALTER COLUMN 3 SET STATISTICS 1000; +</programlisting> + </para> + </refsect1> <refsect1> |