]> begriffs open source - ai-pg/blob - full-docs/html/view-pg-stats-ext-exprs.html
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / html / view-pg-stats-ext-exprs.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>53.31. pg_stats_ext_exprs</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="view-pg-stats-ext.html" title="53.30. pg_stats_ext" /><link rel="next" href="view-pg-tables.html" title="53.32. pg_tables" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">53.31. <code class="structname">pg_stats_ext_exprs</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="view-pg-stats-ext.html" title="53.30. pg_stats_ext">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="views.html" title="Chapter 53. System Views">Up</a></td><th width="60%" align="center">Chapter 53. System Views</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="view-pg-tables.html" title="53.32. pg_tables">Next</a></td></tr></table><hr /></div><div class="sect1" id="VIEW-PG-STATS-EXT-EXPRS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">53.31. <code class="structname">pg_stats_ext_exprs</code> <a href="#VIEW-PG-STATS-EXT-EXPRS" class="id_link">#</a></h2></div></div></div><a id="id-1.10.5.35.2" class="indexterm"></a><p>
3    The view <code class="structname">pg_stats_ext_exprs</code> provides access to
4    information about all expressions included in extended statistics objects,
5    combining information stored in the <a class="link" href="catalog-pg-statistic-ext.html" title="52.52. pg_statistic_ext"><code class="structname">pg_statistic_ext</code></a>
6    and <a class="link" href="catalog-pg-statistic-ext-data.html" title="52.53. pg_statistic_ext_data"><code class="structname">pg_statistic_ext_data</code></a>
7    catalogs.  This view allows access only to rows of
8    <a class="link" href="catalog-pg-statistic-ext.html" title="52.52. pg_statistic_ext"><code class="structname">pg_statistic_ext</code></a> and <a class="link" href="catalog-pg-statistic-ext-data.html" title="52.53. pg_statistic_ext_data"><code class="structname">pg_statistic_ext_data</code></a>
9    that correspond to tables the user owns, and therefore
10    it is safe to allow public read access to this view.
11   </p><p>
12    <code class="structname">pg_stats_ext_exprs</code> is also designed to present
13    the information in a more readable format than the underlying catalogs
14    — at the cost that its schema must be extended whenever the structure
15    of statistics in <code class="structname">pg_statistic_ext</code> changes.
16   </p><div class="table" id="id-1.10.5.35.5"><p class="title"><strong>Table 53.31. <code class="structname">pg_stats_ext_exprs</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_stats_ext_exprs Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
17        Column Type
18       </p>
19       <p>
20        Description
21       </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
22        <code class="structfield">schemaname</code> <code class="type">name</code>
23        (references <a class="link" href="catalog-pg-namespace.html" title="52.32. pg_namespace"><code class="structname">pg_namespace</code></a>.<code class="structfield">nspname</code>)
24       </p>
25       <p>
26        Name of schema containing table
27       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
28        <code class="structfield">tablename</code> <code class="type">name</code>
29        (references <a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">relname</code>)
30       </p>
31       <p>
32        Name of table the statistics object is defined on
33       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
34        <code class="structfield">statistics_schemaname</code> <code class="type">name</code>
35        (references <a class="link" href="catalog-pg-namespace.html" title="52.32. pg_namespace"><code class="structname">pg_namespace</code></a>.<code class="structfield">nspname</code>)
36       </p>
37       <p>
38        Name of schema containing extended statistics object
39       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
40        <code class="structfield">statistics_name</code> <code class="type">name</code>
41        (references <a class="link" href="catalog-pg-statistic-ext.html" title="52.52. pg_statistic_ext"><code class="structname">pg_statistic_ext</code></a>.<code class="structfield">stxname</code>)
42       </p>
43       <p>
44        Name of extended statistics object
45       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
46        <code class="structfield">statistics_owner</code> <code class="type">name</code>
47        (references <a class="link" href="catalog-pg-authid.html" title="52.8. pg_authid"><code class="structname">pg_authid</code></a>.<code class="structfield">rolname</code>)
48       </p>
49       <p>
50        Owner of the extended statistics object
51       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
52        <code class="structfield">expr</code> <code class="type">text</code>
53       </p>
54       <p>
55        Expression included in the extended statistics object
56       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
57        <code class="structfield">inherited</code> <code class="type">bool</code>
58        (references <a class="link" href="catalog-pg-statistic-ext-data.html" title="52.53. pg_statistic_ext_data"><code class="structname">pg_statistic_ext_data</code></a>.<code class="structfield">stxdinherit</code>)
59       </p>
60       <p>
61        If true, the stats include values from child tables, not just the
62        values in the specified relation
63       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
64        <code class="structfield">null_frac</code> <code class="type">float4</code>
65       </p>
66       <p>
67        Fraction of expression entries that are null
68       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
69        <code class="structfield">avg_width</code> <code class="type">int4</code>
70       </p>
71       <p>
72        Average width in bytes of expression's entries
73       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
74        <code class="structfield">n_distinct</code> <code class="type">float4</code>
75       </p>
76       <p>
77        If greater than zero, the estimated number of distinct values in the
78        expression.  If less than zero, the negative of the number of distinct
79        values divided by the number of rows.  (The negated form is used when
80        <code class="command">ANALYZE</code> believes that the number of distinct values is
81        likely to increase as the table grows; the positive form is used when
82        the expression seems to have a fixed number of possible values.)  For
83        example, -1 indicates a unique expression in which the number of distinct
84        values is the same as the number of rows.
85       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
86        <code class="structfield">most_common_vals</code> <code class="type">anyarray</code>
87       </p>
88       <p>
89        A list of the most common values in the expression. (Null if
90        no values seem to be more common than any others.)
91       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
92        <code class="structfield">most_common_freqs</code> <code class="type">float4[]</code>
93       </p>
94       <p>
95        A list of the frequencies of the most common values,
96        i.e., number of occurrences of each divided by total number of rows.
97        (Null when <code class="structfield">most_common_vals</code> is.)
98       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
99        <code class="structfield">histogram_bounds</code> <code class="type">anyarray</code>
100       </p>
101       <p>
102        A list of values that divide the expression's values into groups of
103        approximately equal population.  The values in
104        <code class="structfield">most_common_vals</code>, if present, are omitted from this
105        histogram calculation.  (This expression is null if the expression data type
106        does not have a <code class="literal">&lt;</code> operator or if the
107        <code class="structfield">most_common_vals</code> list accounts for the entire
108        population.)
109       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
110        <code class="structfield">correlation</code> <code class="type">float4</code>
111       </p>
112       <p>
113        Statistical correlation between physical row ordering and
114        logical ordering of the expression values.  This ranges from -1 to +1.
115        When the value is near -1 or +1, an index scan on the expression will
116        be estimated to be cheaper than when it is near zero, due to reduction
117        of random access to the disk.  (This expression is null if the expression's
118        data type does not have a <code class="literal">&lt;</code> operator.)
119       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
120        <code class="structfield">most_common_elems</code> <code class="type">anyarray</code>
121       </p>
122       <p>
123        A list of non-null element values most often appearing within values of
124        the expression. (Null for scalar types.)
125       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
126        <code class="structfield">most_common_elem_freqs</code> <code class="type">float4[]</code>
127       </p>
128       <p>
129        A list of the frequencies of the most common element values, i.e., the
130        fraction of rows containing at least one instance of the given value.
131        Two or three additional values follow the per-element frequencies;
132        these are the minimum and maximum of the preceding per-element
133        frequencies, and optionally the frequency of null elements.
134        (Null when <code class="structfield">most_common_elems</code> is.)
135       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
136        <code class="structfield">elem_count_histogram</code> <code class="type">float4[]</code>
137       </p>
138       <p>
139        A histogram of the counts of distinct non-null element values within the
140        values of the expression, followed by the average number of distinct
141        non-null elements.  (Null for scalar types.)
142       </p></td></tr></tbody></table></div></div><br class="table-break" /><p>
143    The maximum number of entries in the array fields can be controlled on a
144    column-by-column basis using the <a class="link" href="sql-altertable.html" title="ALTER TABLE"><code class="command">ALTER
145    TABLE SET STATISTICS</code></a> command, or globally by setting the
146    <a class="xref" href="runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET">default_statistics_target</a> run-time parameter.
147   </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="view-pg-stats-ext.html" title="53.30. pg_stats_ext">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="views.html" title="Chapter 53. System Views">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="view-pg-tables.html" title="53.32. pg_tables">Next</a></td></tr><tr><td width="40%" align="left" valign="top">53.30. <code class="structname">pg_stats_ext</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 53.32. <code class="structname">pg_tables</code></td></tr></table></div></body></html>