Skip to content

Latest commit

 

History

History
106 lines (76 loc) · 3.94 KB

20231128_01.md

File metadata and controls

106 lines (76 loc) · 3.94 KB

PostgreSQL 17 preview - improve range type pg_stats

作者

digoal

日期

2023-11-28

标签

PostgreSQL , PolarDB , pg_stats , range


背景

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=bc3c8db8ae2f899cfd65edce99fe9cf65caf1ed7

Display length and bounds histograms in pg_stats
author  Alexander Korotkov <akorotkov@postgresql.org> 
Sun, 26 Nov 2023 23:30:39 +0000 (01:30 +0200)
committer Alexander Korotkov <akorotkov@postgresql.org> 
Sun, 26 Nov 2023 23:32:17 +0000 (01:32 +0200)
commit  bc3c8db8ae2f899cfd65edce99fe9cf65caf1ed7
tree  6d5f6620a3be298e871c3fbfccb434a3f2df8283  tree
parent  441c8a31349105590e778fe7dd1db0d0c89299df  commit | diff
Display length and bounds histograms in pg_stats

Values corresponding to STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM and
STATISTIC_KIND_BOUNDS_HISTOGRAM were not exposed to pg_stats when these
slot kinds were introduced in 918eee0c49.

This commit adds the missing fields to pg_stats.

Catversion is bumped.

Discussion: https://postgr.es/m/flat/b67d8b57-9357-7e82-a2e7-f6ce6eaeec67@postgrespro.ru
Author: Egor Rogov, Soumyadeep Chakraborty
Reviewed-by: Tomas Vondra, Justin Pryzby, Jian He
+     <row>
+      <entry role="catalog_table_entry"><para role="column_definition">
+       <structfield>range_length_histogram</structfield> <type>anyarray</type>
+      </para>
+      <para>
+       A histogram of the lengths of non-empty and non-null range values of a
+       range type column. (Null for non-range types.)
+      </para>
+      <para>
+       This histogram is calculated using the <literal>subtype_diff</literal>
+       range function regardless of whether range bounds are inclusive.
+      </para></entry>
+     </row>
+
+     <row>
+      <entry role="catalog_table_entry"><para role="column_definition">
+       <structfield>range_empty_frac</structfield> <type>float4</type>
+      </para>
+      <para>
+       Fraction of column entries whose values are empty ranges.
+       (Null for non-range types.)
+      </para></entry>
+     </row>
+
+     <row>
+      <entry role="catalog_table_entry"><para role="column_definition">
+       <structfield>range_bounds_histogram</structfield> <type>anyarray</type>
+      </para>
+      <para>
+       A histogram of lower and upper bounds of non-empty and non-null range
+       values. (Null for non-range types.)
+      </para>
+      <para>
+       These two histograms are represented as a single array of ranges, whose
+       lower bounds represent the histogram of lower bounds, and upper bounds
+       represent the histogram of upper bounds.
+      </para></entry>

digoal's wechat