doc-exports/docs/dws/dev/dws_04_0754.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

164 lines
16 KiB
HTML

<a name="EN-US_TOPIC_0000001233883291"></a><a name="EN-US_TOPIC_0000001233883291"></a>
<h1 class="topictitle1">PG_STATS</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001233883291__a23b05434e52f45619b6f9cd247df5541"><strong id="EN-US_TOPIC_0000001233883291__b842352706135847">PG_STATS</strong> displays the single-column statistics stored in the <strong id="EN-US_TOPIC_0000001233883291__b842352706135850">pg_statistic</strong> table.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233883291__t0cc79f66b0534f8289e3e9823cfdbbd6" frame="border" border="1" rules="all"><caption><b>Table 1 </b>PG_STATS columns</caption><thead align="left"><tr id="EN-US_TOPIC_0000001233883291__r694980dfc91e46bbb6e75e98ce75c675"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.2.5.1.1"><p id="EN-US_TOPIC_0000001233883291__ad54d37637d5e449c8030e06cd74fade6"><strong id="EN-US_TOPIC_0000001233883291__b84235270691445">Name</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.2.2.5.1.2"><p id="EN-US_TOPIC_0000001233883291__af2fac1fe8d0f4d1eadd73c01359f7f51">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.2.5.1.3"><p id="EN-US_TOPIC_0000001233883291__acf13354fe5ee44829a684de4fa0baaba">Reference</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45%" id="mcps1.3.2.2.5.1.4"><p id="EN-US_TOPIC_0000001233883291__a870dd282f1274282a1e0c49641e774a3">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001233883291__rbf9af765b4da45e799c4d577ce345eb6"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__afb882b5fac144bcd9632859fc9fdb029">schemaname</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__aaaad16af290e41a386b0f840ebfb294e">name</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a8dd065362bdd4afca70e8d8c425546f7"><a href="dws_04_0600.html">PG_NAMESPACE</a>.nspname</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a144deaf587e74676bfb323bac9e4804e">Name of the schema that contains the table</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__rc4653bf79b104b5c9768c6cc9b5d9724"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a97baf92fd13d4cad8e213ae3cdc9cfab">tablename</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__af11a9c4ef65a48bd8b9d30564335b325">name</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a59c80818aaff4f32bea9c4caf06da557"><a href="dws_04_0578.html">PG_CLASS</a>.relname</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a31673dffc45c41fbbbb78af7dafa09de">Name of the table</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r24b9e8b523f1491e941fdc8325844e04"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a9e9616cbec574c3d8643eec325b044a3">attname</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__ab626f1cb918148c099849c6fa460228e">name</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__aa40b63d061d54c7e958759465ae25061"><a href="dws_04_0573.html">PG_ATTRIBUTE</a>.attname</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a712acd6365744d3b812f03e91a8a0e8d">Column name</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r057f829e63a9454c8b61073f0171a756"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__ad6fee5c4532049e6b8ff04528088a069">inherited</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__ad6250e5c32c9445dae72d57489e4eb01"><span id="EN-US_TOPIC_0000001233883291__text15054279389">boolean</span></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a0887a46cafa340bbb9b2a9a33d215c35">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a0c8823227403445d93907f4bb0a8e376">Includes inherited sub-columns if the value is <strong id="EN-US_TOPIC_0000001233883291__b88241912866">true</strong>; otherwise, indicates the column in a specified table.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r0c30976e19e14cc1ba7c086a1c2d6c2c"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a6a620f4fa2dd470288c29e44195e50fe">null_frac</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a37079f4f16f5455c814d14e65cdf151c">real</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a10453840e7a3456c952ec3ca186bc890">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__ab72787ac6bec45e8b9fb856fa9897b47">Percentage of column entries that are null</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r7a2db89099af4ee7addf9497965f53c7"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a2b83121a6dfd4e148b93ff7fff716448">avg_width</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a6dab776c1bd544a787b8c2845c54cddf">integer</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__ad40a33b8b91d4118b43529892350f778">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__ac5310941d33f4c27801238720be82aaf">Average width in bytes of column's entries</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r6e7ea05686a446a7a25d0fb71fbb4187"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__abf72bff9d598400083565ae00b730436">n_distinct</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__afa1cc6f996f84ffea4e4d28da3137c16">real</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a23a4007c16414663844c28c0fa03f0f1">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><ul id="EN-US_TOPIC_0000001233883291__u5c026370c3444238b630ec986591d772"><li id="EN-US_TOPIC_0000001233883291__l12a0ebe92bf747808dd37d54ac8f149e">Estimated number of distinct values in the column if the value is greater than 0</li><li id="EN-US_TOPIC_0000001233883291__ldfa12f07e2744a99bb609c9c664433fe">Negative of the number of distinct values divided by the number of rows if the value is less than 0</li></ul>
<p id="EN-US_TOPIC_0000001233883291__a79a192f676dd4db0b4020a1b88a72d50">The negated form is used when ANALYZE believes that the number of distinct values is likely to increase as the table grows.</p>
<p id="EN-US_TOPIC_0000001233883291__aa32274571f454c66be3dd68a19b8b9dd">The positive form is used when the column seems to have a fixed number of possible values. For example, <strong id="EN-US_TOPIC_0000001233883291__b84235270693937">-1</strong> indicates a unique column in which the number of distinct values is the same as the number of rows.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__rdfb1afdbb25240d18b3828df98e3878b"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a37a8f0b0575f4576b57bb4fb33b54600">n_dndistinct</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a463c33036cf64c15a036e229df465507">real</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a45622a6ee3f248a69c23e75924c008dc">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__ae119bd57505b426789e67631a681b68b">Number of unique non-null data values in the <strong id="EN-US_TOPIC_0000001233883291__b84235270695425">dn1</strong> column</p>
<ul id="EN-US_TOPIC_0000001233883291__u0b6d15c737404aa1ac54a78ba72c77e9"><li id="EN-US_TOPIC_0000001233883291__lac4b6811bd0d4693be831cd371d1ca79">Exact number of distinct values if the value is greater than 0</li><li id="EN-US_TOPIC_0000001233883291__l645d8e55884f4557ba0ae2d6f778c7a7">Negative of the number of distinct values divided by the number of rows if the value is less than 0 (For example, if the value of a column appears twice in average, set <strong id="EN-US_TOPIC_0000001233883291__b84235270616816">n_dndistinct=-0.5</strong>.)</li><li id="EN-US_TOPIC_0000001233883291__l0fc0a32dc3cd48a7a00a093d3ce827b2">The number of distinct values is unknown if the value is <strong id="EN-US_TOPIC_0000001233883291__b1193118582139">0</strong>.</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__rea3d8a5ce6fb43ca88341cd20b72d475"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__ade8b29c686a14ba3a3f0771f1ec3efd3">most_common_vals</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a0458f418f54947c1b242db2c9ca44780">anyarray</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a952a1455a1f443118bf6e09c1b429633">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a03013686013e49d6a6d2d7acdc5b75b6">List of the most common values in a column. If this combination does not have the most common values, it will be <strong id="EN-US_TOPIC_0000001233883291__b16394175032013">NULL</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r6a787e8d272d411a9ac8d945230b8da5"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__aeefde76be849497282f623ad90390e76">most_common_freqs</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a8fad72e3ca2f41b2a13f712485c32035">real[]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a299ec1adab1d4746b96a250a45ac6863">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a29c1b15de34a4a18b8a984c499e04ff6">List of the frequencies of the most common values, that is, the number of occurrences of each value divided by the total number of rows. (NULL if <strong id="EN-US_TOPIC_0000001233883291__b133541058267">most_common_vals</strong> is <strong id="EN-US_TOPIC_0000001233883291__b5354175819615">NULL</strong>)</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r0ddfb3bd8e1044749d41ada07607587e"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a2746374841874deb964b77ef12bc9ce8">histogram_bounds</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a478ccee6cb80433f81c0b1bbfe1a5a69">anyarray</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a4961748f1d2140bb8696ea0f61f0c7e6">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a9e2513bec9bd4ec09b9fc37423af63b4">List of values that divide the column's values into groups of equal proportion. The values in <strong id="EN-US_TOPIC_0000001233883291__b314284115143">most_common_vals</strong>, if present, are omitted from this histogram calculation. This field is null if the field data type does not have a <strong id="EN-US_TOPIC_0000001233883291__abbea32cb00894f179496b0ae115b889f">&lt;</strong> operator or if the <strong id="EN-US_TOPIC_0000001233883291__afa9dfd2a7ecb4cd1b599f0e8eec419f0">most_common_vals</strong> list accounts for the entire population.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__rddf7d6179b794a70896ee0662a6fac5e"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a23a502bbad1848dd89bce8d726560833">correlation</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a4aad82ea0f76406b881b7cbc3012c3d6">real</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a4fa2045c4f074368a0b07ee2362cc287">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a219d2faf9beb4ae1a32bbc60184a50d0">Statistical correlation between physical row ordering and logical ordering of the column values. It ranges from -1 to +1. When the value is near to -1 or +1, an index scan on the column is estimated to be cheaper than when it is near to zero, due to reduction of random access to the disk. This column is null if the column data type does not have a &lt; operator.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r023857fc5967438e85ee6da9ded00153"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__ae74f1df023ee4ba9ba69ac13120604cc">most_common_elems</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a07ba05b701a34aa5ac8c09633b459421">anyarray</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__afe2643b3b32c4c628201067512f45b00">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a096693f074af445aa60ab6a6f25ec8df">Specifies a list of non-null element values most often appearing.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r850630fabd1b41a1b03ceafe035088f2"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a38580192053b4d27ae9abe10df496ebe">most_common_elem_freqs</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__a7c7a769536684e4695716f7609ef621a">real[]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__a481fd6e012af48a9ad9de32166c78e5f">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__ae2bc39c7e5bc433e86cb4ccf71a94c26">Specifies a list of the frequencies of the most common element values.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233883291__r1072d11778db42ddb978b568608c836f"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001233883291__a5c34ece3d0254234ba6c73d4d7595e89">elem_count_histogram</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001233883291__ac51b3a92f5874ae690676f385ffcb3a1">real[]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001233883291__ac9078accfd684a91b39c9da6d272bcd1">-</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001233883291__a1d49c1a031334dc2a2479efecd3b6494">Specifies a histogram of the counts of distinct non-null element values.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0639.html">System Views</a></div>
</div>
</div>