summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/functions-statistics.html
blob: 26629a333eec85fe9044b38d0abb772183883603 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>9.30. Statistics Information Functions</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="functions-event-triggers.html" title="9.29. Event Trigger Functions" /><link rel="next" href="typeconv.html" title="Chapter 10. Type Conversion" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">9.30. Statistics Information Functions</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="functions-event-triggers.html" title="9.29. Event Trigger Functions">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="functions.html" title="Chapter 9. Functions and Operators">Up</a></td><th width="60%" align="center">Chapter 9. Functions and Operators</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="typeconv.html" title="Chapter 10. Type Conversion">Next</a></td></tr></table><hr /></div><div class="sect1" id="FUNCTIONS-STATISTICS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">9.30. Statistics Information Functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="functions-statistics.html#FUNCTIONS-STATISTICS-MCV">9.30.1. Inspecting MCV Lists</a></span></dt></dl></div><a id="id-1.5.8.36.2" class="indexterm"></a><p>
    <span class="productname">PostgreSQL</span> provides a function to inspect complex
    statistics defined using the <code class="command">CREATE STATISTICS</code> command.
   </p><div class="sect2" id="FUNCTIONS-STATISTICS-MCV"><div class="titlepage"><div><div><h3 class="title">9.30.1. Inspecting MCV Lists</h3></div></div></div><a id="id-1.5.8.36.4.2" class="indexterm"></a><pre class="synopsis">
<code class="function">pg_mcv_list_items</code> ( <code class="type">pg_mcv_list</code> ) → <code class="returnvalue">setof record</code>
</pre><p>
    <code class="function">pg_mcv_list_items</code> returns a set of records describing
    all items stored in a multi-column <acronym class="acronym">MCV</acronym> list.  It
    returns the following columns:

    </p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">index</code></td><td><code class="type">integer</code></td><td>index of the item in the <acronym class="acronym">MCV</acronym> list</td></tr><tr><td><code class="literal">values</code></td><td><code class="type">text[]</code></td><td>values stored in the MCV item</td></tr><tr><td><code class="literal">nulls</code></td><td><code class="type">boolean[]</code></td><td>flags identifying <code class="literal">NULL</code> values</td></tr><tr><td><code class="literal">frequency</code></td><td><code class="type">double precision</code></td><td>frequency of this <acronym class="acronym">MCV</acronym> item</td></tr><tr><td><code class="literal">base_frequency</code></td><td><code class="type">double precision</code></td><td>base frequency of this <acronym class="acronym">MCV</acronym> item</td></tr></tbody></table></div><p>
   </p><p>
    The <code class="function">pg_mcv_list_items</code> function can be used like this:

</p><pre class="programlisting">
SELECT m.* FROM pg_statistic_ext join pg_statistic_ext_data on (oid = stxoid),
                pg_mcv_list_items(stxdmcv) m WHERE stxname = 'stts';
</pre><p>

    Values of the <code class="type">pg_mcv_list</code> type can be obtained only from the
    <code class="structname">pg_statistic_ext_data</code>.<code class="structfield">stxdmcv</code>
    column.
   </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="functions-event-triggers.html" title="9.29. Event Trigger Functions">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="functions.html" title="Chapter 9. Functions and Operators">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="typeconv.html" title="Chapter 10. Type Conversion">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.29. Event Trigger Functions </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Type Conversion</td></tr></table></div></body></html>