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.30. pg_stats_ext</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.html" title="53.29. pg_stats" /><link rel="next" href="view-pg-stats-ext-exprs.html" title="53.31. pg_stats_ext_exprs" /></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.30. <code class="structname">pg_stats_ext</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="view-pg-stats.html" title="53.29. pg_stats">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-stats-ext-exprs.html" title="53.31. pg_stats_ext_exprs">Next</a></td></tr></table><hr /></div><div class="sect1" id="VIEW-PG-STATS-EXT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">53.30. <code class="structname">pg_stats_ext</code> <a href="#VIEW-PG-STATS-EXT" class="id_link">#</a></h2></div></div></div><a id="id-1.10.5.34.2" class="indexterm"></a><p>
3 The view <code class="structname">pg_stats_ext</code> provides access to
4 information about each extended statistics object in the database,
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.
12 <code class="structname">pg_stats_ext</code> is also designed to present the
13 information in a more readable format than the underlying catalogs
14 — at the cost that its schema must be extended whenever new types
15 of extended statistics are added to <a class="link" href="catalog-pg-statistic-ext.html" title="52.52. pg_statistic_ext"><code class="structname">pg_statistic_ext</code></a>.
16 </p><div class="table" id="id-1.10.5.34.5"><p class="title"><strong>Table 53.30. <code class="structname">pg_stats_ext</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_stats_ext Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
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>)
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>)
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>)
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>)
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>)
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">attnames</code> <code class="type">name[]</code>
53 (references <a class="link" href="catalog-pg-attribute.html" title="52.7. pg_attribute"><code class="structname">pg_attribute</code></a>.<code class="structfield">attname</code>)
56 Names of the columns included in the extended statistics object
57 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
58 <code class="structfield">exprs</code> <code class="type">text[]</code>
61 Expressions included in the extended statistics object
62 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
63 <code class="structfield">kinds</code> <code class="type">char[]</code>
66 Types of extended statistics object enabled for this record
67 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
68 <code class="structfield">inherited</code> <code class="type">bool</code>
69 (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>)
72 If true, the stats include values from child tables, not just the
73 values in the specified relation
74 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
75 <code class="structfield">n_distinct</code> <code class="type">pg_ndistinct</code>
78 N-distinct counts for combinations of column values. If greater
79 than zero, the estimated number of distinct values in the combination.
80 If less than zero, the negative of the number of distinct values divided
81 by the number of rows.
82 (The negated form is used when <code class="command">ANALYZE</code> believes that
83 the number of distinct values is likely to increase as the table grows;
84 the positive form is used when the column seems to have a fixed number
85 of possible values.) For example, -1 indicates a unique combination of
86 columns in which the number of distinct combinations is the same as the
88 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
89 <code class="structfield">dependencies</code> <code class="type">pg_dependencies</code>
92 Functional dependency statistics
93 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
94 <code class="structfield">most_common_vals</code> <code class="type">text[]</code>
97 A list of the most common combinations of values in the columns.
98 (Null if no combinations seem to be more common than any others.)
99 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
100 <code class="structfield">most_common_val_nulls</code> <code class="type">bool[]</code>
103 A list of NULL flags for the most common combinations of values.
104 (Null when <code class="structfield">most_common_vals</code> is.)
105 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
106 <code class="structfield">most_common_freqs</code> <code class="type">float8[]</code>
109 A list of the frequencies of the most common combinations,
110 i.e., number of occurrences of each divided by total number of rows.
111 (Null when <code class="structfield">most_common_vals</code> is.)
112 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
113 <code class="structfield">most_common_base_freqs</code> <code class="type">float8[]</code>
116 A list of the base frequencies of the most common combinations,
117 i.e., product of per-value frequencies.
118 (Null when <code class="structfield">most_common_vals</code> is.)
119 </p></td></tr></tbody></table></div></div><br class="table-break" /><p>
120 The maximum number of entries in the array fields can be controlled on a
121 column-by-column basis using the <a class="link" href="sql-altertable.html" title="ALTER TABLE"><code class="command">ALTER
122 TABLE SET STATISTICS</code></a> command, or globally by setting the
123 <a class="xref" href="runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET">default_statistics_target</a> run-time parameter.
124 </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.html" title="53.29. pg_stats">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-stats-ext-exprs.html" title="53.31. pg_stats_ext_exprs">Next</a></td></tr><tr><td width="40%" align="left" valign="top">53.29. <code class="structname">pg_stats</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.31. <code class="structname">pg_stats_ext_exprs</code></td></tr></table></div></body></html>