From 0bea40cc7ab57fe5568e891a9e5e3d2d48054069 Mon Sep 17 00:00:00 2001
From: Dmitrii Dolgov <9erthalion6@gmail.com>
Date: Mon, 8 Jun 2020 20:45:21 +0200
Subject: [PATCH 6/7] Index skip scan documentation
Covers added GUC and the extenion of index am interface.
Author: Jesper Pedersen, Dmitry Dolgov
Reviewed-by: Thomas Munro, David Rowley, Floris Van Nee, Kyotaro Horiguchi, Tomas Vondra, Peter Geoghegan
---
doc/src/sgml/config.sgml | 15 ++++++++++
doc/src/sgml/indexam.sgml | 62 +++++++++++++++++++++++++++++++++++++++
doc/src/sgml/indices.sgml | 23 +++++++++++++++
3 files changed, 100 insertions(+)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index b353c61683..aa89e96fc0 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -4620,6 +4620,21 @@ ANY num_sync (
+ enable_indexskipscan (boolean)
+
+ enable_indexskipscan configuration parameter
+
+
+
+
+ Enables or disables the query planner's use of index-skip-scan plan
+ types (see ). The default is
+ on.
+
+
+
+
enable_material (boolean)
diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml
index 8c552c22bd..b3ca91211f 100644
--- a/doc/src/sgml/indexam.sgml
+++ b/doc/src/sgml/indexam.sgml
@@ -694,6 +694,68 @@ amrestrpos (IndexScanDesc scan);
+bool
+amskip (IndexScanDesc scan,
+ ScanDirection direction,
+ ScanDirection indexdir,
+ bool scanstart,
+ int prefix);
+
+ Skip past all tuples where the first 'prefix' columns have the same value as
+ the last tuple returned in the current scan. The arguments are:
+
+
+
+ scan
+
+
+ Index scan information
+
+
+
+
+
+ direction
+
+
+ The direction in which data is advancing.
+
+
+
+
+
+ indexdir
+
+
+ The index direction, in which data must be read.
+
+
+
+
+
+ scanstart
+
+
+ Whether or not it is a start of the scan.
+
+
+
+
+
+ prefix
+
+
+ Distinct prefix size.
+
+
+
+
+
+
+
+
+
+
Size
amestimateparallelscan (void);
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 28adaba72d..1cf8550e0c 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -1281,6 +1281,29 @@ SELECT target FROM tests WHERE subject = 'some-subject' AND success;
and later will recognize such cases and allow index-only scans to be
generated, but older versions will not.
+
+
+ Index Skip Scans
+
+
+ index
+ index-skip scans
+
+
+ index-skip scan
+
+
+
+ When the rows retrieved from an index scan are then deduplicated by
+ eliminating rows matching on a prefix of index keys (e.g. when using
+ SELECT DISTINCT), the planner will consider
+ skipping groups of rows with a matching key prefix. When a row with
+ a particular prefix is found, remaining rows with the same key prefix
+ are skipped. The larger the number of rows with the same key prefix
+ rows (i.e. the lower the number of distinct key prefixes in the index),
+ the more efficient this is.
+
+
--
2.25.0