Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
pg_statistic_d.h196 linesDownload Raw Back to catalog
1/*-------------------------------------------------------------------------
2 *
3 * pg_statistic_d.h
4 *    Macro definitions for pg_statistic
5 *
6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * NOTES
10 *  ******************************
11 *  *** DO NOT EDIT THIS FILE! ***
12 *  ******************************
13 *
14 *  It has been GENERATED by src/backend/catalog/genbki.pl
15 *
16 *-------------------------------------------------------------------------
17 */
18#ifndef PG_STATISTIC_D_H
19#define PG_STATISTIC_D_H
20
21#define StatisticRelationId 2619
22#define StatisticRelidAttnumInhIndexId 2696
23
24#define Anum_pg_statistic_starelid 1
25#define Anum_pg_statistic_staattnum 2
26#define Anum_pg_statistic_stainherit 3
27#define Anum_pg_statistic_stanullfrac 4
28#define Anum_pg_statistic_stawidth 5
29#define Anum_pg_statistic_stadistinct 6
30#define Anum_pg_statistic_stakind1 7
31#define Anum_pg_statistic_stakind2 8
32#define Anum_pg_statistic_stakind3 9
33#define Anum_pg_statistic_stakind4 10
34#define Anum_pg_statistic_stakind5 11
35#define Anum_pg_statistic_staop1 12
36#define Anum_pg_statistic_staop2 13
37#define Anum_pg_statistic_staop3 14
38#define Anum_pg_statistic_staop4 15
39#define Anum_pg_statistic_staop5 16
40#define Anum_pg_statistic_stacoll1 17
41#define Anum_pg_statistic_stacoll2 18
42#define Anum_pg_statistic_stacoll3 19
43#define Anum_pg_statistic_stacoll4 20
44#define Anum_pg_statistic_stacoll5 21
45#define Anum_pg_statistic_stanumbers1 22
46#define Anum_pg_statistic_stanumbers2 23
47#define Anum_pg_statistic_stanumbers3 24
48#define Anum_pg_statistic_stanumbers4 25
49#define Anum_pg_statistic_stanumbers5 26
50#define Anum_pg_statistic_stavalues1 27
51#define Anum_pg_statistic_stavalues2 28
52#define Anum_pg_statistic_stavalues3 29
53#define Anum_pg_statistic_stavalues4 30
54#define Anum_pg_statistic_stavalues5 31
55
56#define Natts_pg_statistic 31
57
58
59/*
60 * Several statistical slot "kinds" are defined by core PostgreSQL, as
61 * documented below.  Also, custom data types can define their own "kind"
62 * codes by mutual agreement between a custom typanalyze routine and the
63 * selectivity estimation functions of the type's operators.
64 *
65 * Code reading the pg_statistic relation should not assume that a particular
66 * data "kind" will appear in any particular slot.  Instead, search the
67 * stakind fields to see if the desired data is available.  (The standard
68 * function get_attstatsslot() may be used for this.)
69 */
70
71/*
72 * The present allocation of "kind" codes is:
73 *
74 *	1-99:		reserved for assignment by the core PostgreSQL project
75 *				(values in this range will be documented in this file)
76 *	100-199:	reserved for assignment by the PostGIS project
77 *				(values to be documented in PostGIS documentation)
78 *	200-299:	reserved for assignment by the ESRI ST_Geometry project
79 *				(values to be documented in ESRI ST_Geometry documentation)
80 *	300-9999:	reserved for future public assignments
81 *
82 * For private use you may choose a "kind" code at random in the range
83 * 10000-30000.  However, for code that is to be widely disseminated it is
84 * better to obtain a publicly defined "kind" code by request from the
85 * PostgreSQL Global Development Group.
86 */
87
88/*
89 * In a "most common values" slot, staop is the OID of the "=" operator
90 * used to decide whether values are the same or not, and stacoll is the
91 * collation used (same as column's collation).  stavalues contains
92 * the K most common non-null values appearing in the column, and stanumbers
93 * contains their frequencies (fractions of total row count).  The values
94 * shall be ordered in decreasing frequency.  Note that since the arrays are
95 * variable-size, K may be chosen by the statistics collector.  Values should
96 * not appear in MCV unless they have been observed to occur more than once;
97 * a unique column will have no MCV slot.
98 */
99#define STATISTIC_KIND_MCV	1
100
101/*
102 * A "histogram" slot describes the distribution of scalar data.  staop is
103 * the OID of the "<" operator that describes the sort ordering, and stacoll
104 * is the relevant collation.  (In theory more than one histogram could appear,
105 * if a datatype has more than one useful sort operator or we care about more
106 * than one collation.  Currently the collation will always be that of the
107 * underlying column.)  stavalues contains M (>=2) non-null values that
108 * divide the non-null column data values into M-1 bins of approximately equal
109 * population.  The first stavalues item is the MIN and the last is the MAX.
110 * stanumbers is not used and should be NULL.  IMPORTANT POINT: if an MCV
111 * slot is also provided, then the histogram describes the data distribution
112 * *after removing the values listed in MCV* (thus, it's a "compressed
113 * histogram" in the technical parlance).  This allows a more accurate
114 * representation of the distribution of a column with some very-common
115 * values.  In a column with only a few distinct values, it's possible that
116 * the MCV list describes the entire data population; in this case the
117 * histogram reduces to empty and should be omitted.
118 */
119#define STATISTIC_KIND_HISTOGRAM  2
120
121/*
122 * A "correlation" slot describes the correlation between the physical order
123 * of table tuples and the ordering of data values of this column, as seen
124 * by the "<" operator identified by staop with the collation identified by
125 * stacoll.  (As with the histogram, more than one entry could theoretically
126 * appear.)  stavalues is not used and should be NULL.  stanumbers contains
127 * a single entry, the correlation coefficient between the sequence of data
128 * values and the sequence of their actual tuple positions.  The coefficient
129 * ranges from +1 to -1.
130 */
131#define STATISTIC_KIND_CORRELATION	3
132
133/*
134 * A "most common elements" slot is similar to a "most common values" slot,
135 * except that it stores the most common non-null *elements* of the column
136 * values.  This is useful when the column datatype is an array or some other
137 * type with identifiable elements (for instance, tsvector).  staop contains
138 * the equality operator appropriate to the element type, and stacoll
139 * contains the collation to use with it.  stavalues contains
140 * the most common element values, and stanumbers their frequencies.  Unlike
141 * MCV slots, frequencies are measured as the fraction of non-null rows the
142 * element value appears in, not the frequency of all rows.  Also unlike
143 * MCV slots, the values are sorted into the element type's default order
144 * (to support binary search for a particular value).  Since this puts the
145 * minimum and maximum frequencies at unpredictable spots in stanumbers,
146 * there are two extra members of stanumbers, holding copies of the minimum
147 * and maximum frequencies.  Optionally, there can be a third extra member,
148 * which holds the frequency of null elements (expressed in the same terms:
149 * the fraction of non-null rows that contain at least one null element).  If
150 * this member is omitted, the column is presumed to contain no null elements.
151 *
152 * Note: in current usage for tsvector columns, the stavalues elements are of
153 * type text, even though their representation within tsvector is not
154 * exactly text.
155 */
156#define STATISTIC_KIND_MCELEM  4
157
158/*
159 * A "distinct elements count histogram" slot describes the distribution of
160 * the number of distinct element values present in each row of an array-type
161 * column.  Only non-null rows are considered, and only non-null elements.
162 * staop contains the equality operator appropriate to the element type,
163 * and stacoll contains the collation to use with it.
164 * stavalues is not used and should be NULL.  The last member of stanumbers is
165 * the average count of distinct element values over all non-null rows.  The
166 * preceding M (>=2) members form a histogram that divides the population of
167 * distinct-elements counts into M-1 bins of approximately equal population.
168 * The first of these is the minimum observed count, and the last the maximum.
169 */
170#define STATISTIC_KIND_DECHIST	5
171
172/*
173 * A "length histogram" slot describes the distribution of range lengths in
174 * rows of a range-type column. stanumbers contains a single entry, the
175 * fraction of empty ranges. stavalues is a histogram of non-empty lengths, in
176 * a format similar to STATISTIC_KIND_HISTOGRAM: it contains M (>=2) range
177 * values that divide the column data values into M-1 bins of approximately
178 * equal population. The lengths are stored as float8s, as measured by the
179 * range type's subdiff function. Only non-null rows are considered.
180 */
181#define STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM  6
182
183/*
184 * A "bounds histogram" slot is similar to STATISTIC_KIND_HISTOGRAM, but for
185 * a range-type column.  stavalues contains M (>=2) range values that divide
186 * the column data values into M-1 bins of approximately equal population.
187 * Unlike a regular scalar histogram, this is actually two histograms combined
188 * into a single array, with the lower bounds of each value forming a
189 * histogram of lower bounds, and the upper bounds a histogram of upper
190 * bounds.  Only non-NULL, non-empty ranges are included.
191 */
192#define STATISTIC_KIND_BOUNDS_HISTOGRAM  7
193
194
195#endif							/* PG_STATISTIC_D_H */
196 
codekingpro/portable-devtools · Team Ai