From 282f592d23178d0f40061370c7b3da9d76db6a43 Mon Sep 17 00:00:00 2001 From: Dmitrii Dolgov <9erthalion6@gmail.com> Date: Mon, 8 Jun 2020 20:45:21 +0200 Subject: [PATCH v37 6/6] 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 | 52 +++++++++++++++++++++++++++++++++++++++ doc/src/sgml/indices.sgml | 23 +++++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index f043433e31..d205572b99 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -4806,6 +4806,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 1988192fbe..45b0b7b4f1 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -736,6 +736,58 @@ amrestrpos (IndexScanDesc scan); +bool +amskip (IndexScanDesc scan, + ScanDirection direction, + ScanDirection indexdir, + 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. + + + + + + prefix + + + Distinct prefix size. + + + + + + + + + + Size amestimateparallelscan (void); diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml index 671299ff05..07a28d2b5a 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.21.0