]> begriffs open source - ai-pg/blob - full-docs/txt/view-pg-stats.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / view-pg-stats.txt
1
2 53.29. pg_stats #
3
4    The view pg_stats provides access to the information stored in the
5    pg_statistic catalog. This view allows access only to rows of
6    pg_statistic that correspond to tables the user has permission to read,
7    and therefore it is safe to allow public read access to this view.
8
9    pg_stats is also designed to present the information in a more readable
10    format than the underlying catalog — at the cost that its schema must
11    be extended whenever new slot types are defined for pg_statistic.
12
13    Table 53.29. pg_stats Columns
14
15    Column Type
16
17    Description
18
19    schemaname name (references pg_namespace.nspname)
20
21    Name of schema containing table
22
23    tablename name (references pg_class.relname)
24
25    Name of table
26
27    attname name (references pg_attribute.attname)
28
29    Name of column described by this row
30
31    inherited bool
32
33    If true, this row includes values from child tables, not just the
34    values in the specified table
35
36    null_frac float4
37
38    Fraction of column entries that are null
39
40    avg_width int4
41
42    Average width in bytes of column's entries
43
44    n_distinct float4
45
46    If greater than zero, the estimated number of distinct values in the
47    column. If less than zero, the negative of the number of distinct
48    values divided by the number of rows. (The negated form is used when
49    ANALYZE believes that the number of distinct values is likely to
50    increase as the table grows; the positive form is used when the column
51    seems to have a fixed number of possible values.) For example, -1
52    indicates a unique column in which the number of distinct values is the
53    same as the number of rows.
54
55    most_common_vals anyarray
56
57    A list of the most common values in the column. (Null if no values seem
58    to be more common than any others.)
59
60    most_common_freqs float4[]
61
62    A list of the frequencies of the most common values, i.e., number of
63    occurrences of each divided by total number of rows. (Null when
64    most_common_vals is.)
65
66    histogram_bounds anyarray
67
68    A list of values that divide the column's values into groups of
69    approximately equal population. The values in most_common_vals, if
70    present, are omitted from this histogram calculation. (This column is
71    null if the column data type does not have a < operator or if the
72    most_common_vals list accounts for the entire population.)
73
74    correlation float4
75
76    Statistical correlation between physical row ordering and logical
77    ordering of the column values. This ranges from -1 to +1. When the
78    value is near -1 or +1, an index scan on the column will be estimated
79    to be cheaper than when it is near zero, due to reduction of random
80    access to the disk. (This column is null if the column data type does
81    not have a < operator.)
82
83    most_common_elems anyarray
84
85    A list of non-null element values most often appearing within values of
86    the column. (Null for scalar types.)
87
88    most_common_elem_freqs float4[]
89
90    A list of the frequencies of the most common element values, i.e., the
91    fraction of rows containing at least one instance of the given value.
92    Two or three additional values follow the per-element frequencies;
93    these are the minimum and maximum of the preceding per-element
94    frequencies, and optionally the frequency of null elements. (Null when
95    most_common_elems is.)
96
97    elem_count_histogram float4[]
98
99    A histogram of the counts of distinct non-null element values within
100    the values of the column, followed by the average number of distinct
101    non-null elements. (Null for scalar types.)
102
103    range_length_histogram anyarray
104
105    A histogram of the lengths of non-empty and non-null range values of a
106    range type column. (Null for non-range types.)
107
108    This histogram is calculated using the subtype_diff range function
109    regardless of whether range bounds are inclusive.
110
111    range_empty_frac float4
112
113    Fraction of column entries whose values are empty ranges. (Null for
114    non-range types.)
115
116    range_bounds_histogram anyarray
117
118    A histogram of lower and upper bounds of non-empty and non-null range
119    values. (Null for non-range types.)
120
121    These two histograms are represented as a single array of ranges, whose
122    lower bounds represent the histogram of lower bounds, and upper bounds
123    represent the histogram of upper bounds.
124
125    The maximum number of entries in the array fields can be controlled on
126    a column-by-column basis using the ALTER TABLE SET STATISTICS command,
127    or globally by setting the default_statistics_target run-time
128    parameter.