From 5b6d13eec72b960eb0f78542199380e49c8583d4 Mon Sep 17 00:00:00 2001
From: Simon Riggs
Date: Wed, 6 Sep 2017 13:46:01 -0700
Subject: 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
---
doc/src/sgml/ref/alter_index.sgml | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
(limited to 'doc/src')
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 ] name SET
ALTER INDEX name DEPENDS ON EXTENSION extension_name
ALTER INDEX [ IF EXISTS ] name SET ( storage_parameter = value [, ... ] )
ALTER INDEX [ IF EXISTS ] name RESET ( storage_parameter [, ... ] )
+ALTER INDEX [ IF EXISTS ] name ALTER [ COLUMN ] column_number
+ SET STATISTICS integer
ALTER INDEX ALL IN TABLESPACE name [ OWNED BY role_name [, ... ] ]
SET TABLESPACE new_tablespace [ NOWAIT ]
@@ -110,6 +112,25 @@ ALTER INDEX ALL IN TABLESPACE name
+
+ ALTER [ COLUMN ] column_number SET STATISTICS integer
+
+
+ This form sets the per-column statistics-gathering target for
+ subsequent 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 ().
+ For more information on the use of statistics by the
+ PostgreSQL query planner, refer to
+ .
+
+
+
+
@@ -130,6 +151,16 @@ ALTER INDEX ALL IN TABLESPACE name
+
+ column_number
+
+
+ The ordinal number refers to the ordinal (left-to-right) position
+ of the index column.
+
+
+
+
name
@@ -235,6 +266,14 @@ ALTER INDEX distributors SET (fillfactor = 75);
REINDEX INDEX distributors;
+
+ Set the statistics-gathering target for an expression index:
+
+CREATE INDEX coord_idx ON measured (x, y, (z + t));
+ALTER INDEX coord_idx ALTER COLUMN 3 SET STATISTICS 1000;
+
+
+
--
cgit v1.2.3