forked from docs/doc-exports
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>
93 lines
10 KiB
HTML
93 lines
10 KiB
HTML
<a name="EN-US_TOPIC_0000001521770569"></a><a name="EN-US_TOPIC_0000001521770569"></a>
|
||
|
||
<h1 class="topictitle1">PGXC_WLM_TABLE_DISTRIBUTION_SKEWNESS</h1>
|
||
<div id="body0000001521770569"><p id="EN-US_TOPIC_0000001521770569__p1222418279352">PGXC_WLM_TABLE_DISTRIBUTION_SKEWNESS displays data skews of tables in the current database. You can quickly query the storage space skew of all tables in the current database on each node. This view is supported only by clusters of version 8.2.1 or later.</p>
|
||
<p id="EN-US_TOPIC_0000001521770569__p17973185585014">The formula for calculating the skew rate is as follows: Skew rate (SKEW_PERCENT) = (Maximum value – Average value) x 100/Maximum value</p>
|
||
|
||
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001521770569__table1634464513514" frame="border" border="1" rules="all"><caption><b>Table 1 </b>PGXC_WLM_TABLE_DISTRIBUTION_SKEWNESS columns</caption><thead align="left"><tr id="EN-US_TOPIC_0000001521770569__row18344645103510"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.3.2.4.1.1"><p id="EN-US_TOPIC_0000001521770569__p2344174518359">Column</p>
|
||
</th>
|
||
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.3.2.4.1.2"><p id="EN-US_TOPIC_0000001521770569__p1934474511355">Type</p>
|
||
</th>
|
||
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.3.2.4.1.3"><p id="EN-US_TOPIC_0000001521770569__p234410453358">Description</p>
|
||
</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr id="EN-US_TOPIC_0000001521770569__row19344174512351"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001521770569__p334416451355">schema_name</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001521770569__p734474512356">name</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001521770569__p4345145113519">Name of the schema where a table is</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="EN-US_TOPIC_0000001521770569__row1734524583518"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001521770569__p133450457351">table_name</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001521770569__p734514515359">name</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001521770569__p6345184533512">Table name</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="EN-US_TOPIC_0000001521770569__row7345345143512"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001521770569__p163451245153510">total_size</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001521770569__p173951533174413">numeric</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001521770569__p6832821193910">Total storage space of a table on all nodes, in bytes</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="EN-US_TOPIC_0000001521770569__row23451645173510"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001521770569__p1634517450355">avg_size</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001521770569__p1790693812447">numeric(1000,0)</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001521770569__p93582048103919">Average storage space of a table on each node, in bytes</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="EN-US_TOPIC_0000001521770569__row173456458357"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001521770569__p19345145193515">max_percent</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001521770569__p1416011122400">numeric</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001521770569__p4345174553513">Percentage (%) of the maximum storage space of a table on each node to the total storage space</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="EN-US_TOPIC_0000001521770569__row1448510355402"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001521770569__p11894134584011">min_percent</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001521770569__p790584820402">numeric</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001521770569__p179201751134016">Percentage (%) of the minimum storage space of a table on each node to the total storage space</p>
|
||
</td>
|
||
</tr>
|
||
<tr id="EN-US_TOPIC_0000001521770569__row5200134274012"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001521770569__p10200144216405">skew_percent</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001521770569__p49446127411">numeric</p>
|
||
</td>
|
||
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001521770569__p12848131964116">Skew rate (%) of a table</p>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="note" id="EN-US_TOPIC_0000001521770569__note13455455350"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001521770569__ul143454457352"><li id="EN-US_TOPIC_0000001521770569__li1334594523517">To use this view to query the storage distribution information of a specified table, you must have the <strong id="EN-US_TOPIC_0000001521770569__b23521373566">SELECT</strong> permission on the table.</li><li id="EN-US_TOPIC_0000001521770569__li19345174583516">This function is based on the physical file storage space recorded in the <a href="dws_04_1611.html">PG_RELFILENODE_SIZE</a> system catalog. Ensure that the GUC parameters <strong id="EN-US_TOPIC_0000001521770569__b53537496566">use_workload_manager</strong> and <strong id="EN-US_TOPIC_0000001521770569__b1468185245614">enable_perm_space</strong> are enabled.</li><li id="EN-US_TOPIC_0000001521770569__li6175811171113">When you analyze the disk space skew of each table in a database in a large cluster with a large amount of data, the <strong id="EN-US_TOPIC_0000001521770569__b35904017276">PGXC_WLM_TABLE_DISTRIBUTION_SKEWNESS</strong> view delivers better query performance than the <strong id="EN-US_TOPIC_0000001521770569__b581174811279">gs_table_distribution()</strong> function and the <strong id="EN-US_TOPIC_0000001521770569__b19343195312715">PGXC_GET_TABLE_SKEWNESS</strong> view. You are advised to use the <strong id="EN-US_TOPIC_0000001521770569__b14585132816">PGXC_WLM_TABLE_DISTRIBUTION_SKEWNESS</strong> view to query the table skew status overview, and then use the <strong id="EN-US_TOPIC_0000001521770569__b20846317193519">gs_table_distribution(schemaname text, tablename text)</strong> function to obtain the disk space distribution of a specified table on each node.</li></ul>
|
||
</div></div>
|
||
<div class="section" id="EN-US_TOPIC_0000001521770569__section2034114617347"><h4 class="sectiontitle">Example</h4><p id="EN-US_TOPIC_0000001521770569__p91496893418">You can use the <strong id="EN-US_TOPIC_0000001521770569__b97171327372">PGXC_WLM_TABLE_DISTRIBUTION_SKEWNESS</strong> view to query the table skew status overview, and then use the <strong id="EN-US_TOPIC_0000001521770569__b371810219375">gs_table_distribution(schemaname text, tablename text)</strong> function to obtain the disk space distribution of a specified table on each node.</p>
|
||
<ol id="EN-US_TOPIC_0000001521770569__ol58751722172715"><li id="EN-US_TOPIC_0000001521770569__li5876162218275"><span>Use the <strong id="EN-US_TOPIC_0000001521770569__b1075217336384">PGXC_WLM_TABLE_DISTRIBUTION_SKEWNESS</strong> view to query the table skew status overview.</span><p><pre class="screen" id="EN-US_TOPIC_0000001521770569__screen66924513016">tpcds_col=# select * from pgxc_wlm_table_distribution_skewness;</pre>
|
||
<p id="EN-US_TOPIC_0000001521770569__p16643549411">The query result is as follows:</p>
|
||
<p id="EN-US_TOPIC_0000001521770569__p566411596373"><span><img id="EN-US_TOPIC_0000001521770569__image1412892118341" src="figure/en-us_image_0000001481220582.png" width="522.69" height="151.8195" title="Click to enlarge" class="imgResize"></span></p>
|
||
<p id="EN-US_TOPIC_0000001521770569__p8805141912343">The data skew of the <strong id="EN-US_TOPIC_0000001521770569__b52431248393">dbgen_version</strong> table is severe.</p>
|
||
</p></li><li id="EN-US_TOPIC_0000001521770569__li17732531122711"><span>Use the <strong id="EN-US_TOPIC_0000001521770569__b711112233918">gs_table_distribution(schemaname text, tablename text)</strong> function to query the disk space distribution of the <strong id="EN-US_TOPIC_0000001521770569__b18688243153919">dbgen_version</strong> table on each node.</span><p><pre class="screen" id="EN-US_TOPIC_0000001521770569__screen11539519473">tpcds_col=# select * from gs_table_distribution('public','dbgen_version');</pre>
|
||
<p id="EN-US_TOPIC_0000001521770569__p1926442874713">The query result is as follows:</p>
|
||
<p id="EN-US_TOPIC_0000001521770569__p1520314574719"><span><img id="EN-US_TOPIC_0000001521770569__image13811940124915" src="figure/en-us_image_0000001532145549.png" width="522.69" height="92.6478" title="Click to enlarge" class="imgResize"></span></p>
|
||
<p id="EN-US_TOPIC_0000001521770569__p18134246164912">According to the preceding information, data skew occurs in the disk space occupied by the table on DNs. Most data is stored on <strong id="EN-US_TOPIC_0000001521770569__b4739457134016">dn_6005_6006</strong>.</p>
|
||
</p></li></ol>
|
||
</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>
|
||
|
||
|
||
<script language="JavaScript">
|
||
<!--
|
||
image_size('.imgResize');
|
||
var msg_imageMax = "view original image";
|
||
var msg_imageClose = "close";
|
||
//--></script> |