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>
125 lines
28 KiB
HTML
125 lines
28 KiB
HTML
<a name="EN-US_TOPIC_0000001188110538"></a><a name="EN-US_TOPIC_0000001188110538"></a>
|
|
|
|
<h1 class="topictitle1">ANALYZE | ANALYSE</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001188110538__s8b098f6c57504fb5858e11c155dedc28"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001188110538__p15104184462815">ANALYZE collects statistics about table contents in databases, and stores the results in the <strong id="EN-US_TOPIC_0000001188110538__b13186135218454">PG_STATISTIC</strong> system catalog. The execution plan generator uses these statistics to generate a most effective execution plan.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__a1ee19261d333478e8389957a3cdb7d70">If no parameters are specified, <strong id="EN-US_TOPIC_0000001188110538__b139281521181515">ANALYZE</strong> analyzes each table and partitioned table in the database. You can also specify <strong id="EN-US_TOPIC_0000001188110538__b1984330131514">table_name</strong>, <strong id="EN-US_TOPIC_0000001188110538__b2988163017154">column</strong>, and <strong id="EN-US_TOPIC_0000001188110538__b18989133015155">partition_name</strong> to limit the analysis to a specified table, column, or partitioned table.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__p7793127141915">Users who can execute <strong id="EN-US_TOPIC_0000001188110538__b546318455366">ANALYZE</strong> on a specific table include the owner of the table, owner of the database where the table is, users with the <strong id="EN-US_TOPIC_0000001188110538__b16464345143611">ANALYZE</strong> permission on the table, users who are granted the <strong id="EN-US_TOPIC_0000001188110538__b11464194543617">gs_role_analyze_any</strong> role, and users with the <strong id="EN-US_TOPIC_0000001188110538__b5464134553614">SYSADMIN</strong> attribute.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__p16373539153911">To collect statistics using percentage sampling, you must have the <strong id="EN-US_TOPIC_0000001188110538__b138642126216">ANALYZE</strong> and <strong id="EN-US_TOPIC_0000001188110538__b1314831552112">SELECT</strong> permissions.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__p10544154515267"><strong id="EN-US_TOPIC_0000001188110538__b955463161111">ANALYZE</strong> and <strong id="EN-US_TOPIC_0000001188110538__b854918111114">ANALYSE VERIFY</strong> are used to check whether data files of common tables (row-store and column-store tables) in a database are damaged. Currently, this function does not support HDFS tables.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188110538__s8d2691ecc53540518486f0fe0c93be18"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001188110538__ul132000530508"><li id="EN-US_TOPIC_0000001188110538__li1650510115117">Only cluster versions 8.1.1 and later support using anonymous blocks, transaction blocks, functions, or stored procedures to perform the <strong id="EN-US_TOPIC_0000001188110538__b15565104812366">ANALYZE</strong> operation on an unsharded table.</li><li id="EN-US_TOPIC_0000001188110538__li0583161516519">However, for analyzing an entire database, the <strong id="EN-US_TOPIC_0000001188110538__b1019025012510">ANALYZE </strong>operation of each table is in different transactions. Therefore, the current version does not support the <strong id="EN-US_TOPIC_0000001188110538__b132541081165">ANALYZE </strong>execution for the entire database in anonymous blocks, transaction blocks, functions, or stored procedures.</li><li id="EN-US_TOPIC_0000001188110538__li11201253135013">Statistics updates of PG_CLASS related columns cannot be rolled back.</li><li id="EN-US_TOPIC_0000001188110538__li149311022205120">Most <strong id="EN-US_TOPIC_0000001188110538__b185138449512">ANALYZE VERIFY</strong> operations are used for abnormal scenario detection, and require a release version. Remote read is not triggered in the <strong id="EN-US_TOPIC_0000001188110538__b191238470131">ANALYZE VERIFY</strong> scenario. Therefore, the remote read parameter does not take effect. If the system detects that the page is damaged due to an error in the key system table, the system reports an error and stops the detection.</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188110538__s5cec4384333c4217862161b6285843c1"><h4 class="sectiontitle">Syntax</h4><ul id="EN-US_TOPIC_0000001188110538__u5420cd0084904720aa6568de56b42d84"><li id="EN-US_TOPIC_0000001188110538__l08d3bb6f19114e3cb24930a5e3b931df">Collect statistics information about a table.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__sd16ed83e61b1455e92b494c496618e34"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">{</span><span class="w"> </span><span class="k">ANALYZE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ANALYSE</span><span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">VERBOSE</span><span class="w"> </span><span class="p">]</span>
|
|
<span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">table_name</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="k">column_name</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">];</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</li></ul>
|
|
<ul id="EN-US_TOPIC_0000001188110538__u5c1977ee076b4568961c798b68c9822d"><li id="EN-US_TOPIC_0000001188110538__l345b026a8f8446508e40ecebf5c2de80">Collect statistics about a partitioned table.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__s066d07197dcc4b958b3eadae40e14dda"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span>
|
|
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">{</span><span class="w"> </span><span class="k">ANALYZE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ANALYSE</span><span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">VERBOSE</span><span class="w"> </span><span class="p">]</span>
|
|
<span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">table_name</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="k">column_name</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">]</span>
|
|
<span class="w"> </span><span class="n">PARTITION</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="n">patrition_name</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<div class="note" id="EN-US_TOPIC_0000001188110538__n3ddb152d9def4aa698816e33a13e2feb"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188110538__afaccddf2f3154f3b99fc1be9c251e99d">An ordinary partitioned table supports the syntax but not the function of collecting statistics about specified partitions. Run the ANALYZE command on a specified partition. A warning message is displayed.</p>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__l5d2f58a97be945a08a98554a92e48d2a">Collect statistics about a foreign table.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__sfe02410e28314db3a8afc1dadff15b50"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">{</span><span class="w"> </span><span class="k">ANALYZE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ANALYSE</span><span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">VERBOSE</span><span class="w"> </span><span class="p">]</span>
|
|
<span class="w"> </span><span class="err">{</span><span class="w"> </span><span class="n">foreign_table_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">FOREIGN</span><span class="w"> </span><span class="n">TABLES</span><span class="w"> </span><span class="err">}</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<ul id="EN-US_TOPIC_0000001188110538__ul8726161213573"><li id="EN-US_TOPIC_0000001188110538__li16726171265715">Collect statistics about multiple columns.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__screen1331535935911"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">{</span><span class="k">ANALYZE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ANALYSE</span><span class="err">}</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">VERBOSE</span><span class="w"> </span><span class="p">]</span>
|
|
<span class="w"> </span><span class="k">table_name</span><span class="w"> </span><span class="p">((</span><span class="w"> </span><span class="n">column_1_name</span><span class="p">,</span><span class="w"> </span><span class="n">column_2_name</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="p">));</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<div class="note" id="EN-US_TOPIC_0000001188110538__note4869512622"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188110538__ul18710436234"><li id="EN-US_TOPIC_0000001188110538__li67101536231">To sample data in percentage, set <strong id="EN-US_TOPIC_0000001188110538__b7318510246">default_statistics_target</strong> to a negative number.</li><li id="EN-US_TOPIC_0000001188110538__li1358915441349">The statistics about a maximum of 32 columns can be collected at a time.</li><li id="EN-US_TOPIC_0000001188110538__li858615451330">You are not allowed to collect statistics about multiple columns in system catalogs or HDFS foreign tables.</li></ul>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__li12463817192618">Check the data files in the current database.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__screen441663733211"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">{</span><span class="k">ANALYZE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ANALYSE</span><span class="err">}</span><span class="w"> </span><span class="n">VERIFY</span><span class="w"> </span><span class="err">{</span><span class="n">FAST</span><span class="o">|</span><span class="n">COMPLETE</span><span class="err">}</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<div class="note" id="EN-US_TOPIC_0000001188110538__note1167421203220"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188110538__ul16167421143211"><li id="EN-US_TOPIC_0000001188110538__li61671221103211">All operations on the database are supported. Because many tables are involved, you are advised to save the result in redirection mode: <strong id="EN-US_TOPIC_0000001188110538__b2201312101513">gsql -d database -p port -f "verify.sql"> verify_warning.txt 2>&1</strong>.</li><li id="EN-US_TOPIC_0000001188110538__li916812218323">HDFS tables (internal and foreign tables), temporary tables, and unlog tables are not supported.</li><li id="EN-US_TOPIC_0000001188110538__li1716832113210">Note: Only visible tables are checked. Internal table check involves foreign tables on which the internal tables depend and are not displayed or presented externally.</li><li id="EN-US_TOPIC_0000001188110538__li43491433185814">This command can be used to process tolerant errors. The assert operation in a debug version may cause the core to fail to execute commands. Therefore, you are advised to perform this operation in a release version.</li><li id="EN-US_TOPIC_0000001188110538__li6825132173718">If a key system table is damaged during a full database operation, an error is reported and the operation stops.</li></ul>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__li874710291318">Check the data files of tables and indexes.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__screen1293618118414"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">{</span><span class="k">ANALYZE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ANALYSE</span><span class="err">}</span><span class="w"> </span><span class="n">VERIFY</span><span class="w"> </span><span class="err">{</span><span class="n">FAST</span><span class="o">|</span><span class="n">COMPLETE</span><span class="err">}</span><span class="w"> </span><span class="k">table_name</span><span class="o">|</span><span class="n">index_name</span><span class="w"> </span><span class="p">[</span><span class="k">CASCADE</span><span class="p">];</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<div class="note" id="EN-US_TOPIC_0000001188110538__note209367114417"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188110538__ul159365116414"><li id="EN-US_TOPIC_0000001188110538__li493619184120">You can perform operations on common tables and index tables, but cannot perform <strong id="EN-US_TOPIC_0000001188110538__b19992161931915">CASCADE</strong> operations on index tables. The reason is that <strong id="EN-US_TOPIC_0000001188110538__b13263211376">CASCADE</strong> is used to process all index tables of the primary table. When the index table is checked separately, <strong id="EN-US_TOPIC_0000001188110538__b92631811372">CASCADE</strong> is not required.</li><li id="EN-US_TOPIC_0000001188110538__li1493621124116">HDFS tables (internal and foreign tables), temporary tables, and unlog tables are not supported.</li><li id="EN-US_TOPIC_0000001188110538__li1418513151016">When the primary table is checked, the internal tables of the primary table, such as the <strong id="EN-US_TOPIC_0000001188110538__b17170616162013">toast</strong> table and <strong id="EN-US_TOPIC_0000001188110538__b461192012013">cudesc</strong> table, are also checked.</li><li id="EN-US_TOPIC_0000001188110538__li139551412554">When the system displays a message indicating that the index table is damaged, you are advised to run the <strong id="EN-US_TOPIC_0000001188110538__b197101537152015">reindex</strong> command to recreate the index.</li></ul>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__li2639204914316">Check the data file of the table partition.</li></ul>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__screen8232103214507"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">{</span><span class="k">ANALYZE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ANALYSE</span><span class="err">}</span><span class="w"> </span><span class="n">VERIFY</span><span class="w"> </span><span class="err">{</span><span class="n">FAST</span><span class="o">|</span><span class="n">COMPLETE</span><span class="err">}</span><span class="w"> </span><span class="k">table_name</span><span class="w"> </span><span class="n">PARTITION</span><span class="w"> </span><span class="err">{</span><span class="p">(</span><span class="n">partition_name</span><span class="p">)</span><span class="err">}</span><span class="p">[</span><span class="k">CASCADE</span><span class="p">];</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<div class="note" id="EN-US_TOPIC_0000001188110538__note112331732155012"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188110538__ul1723333255016"><li id="EN-US_TOPIC_0000001188110538__li18233163213507">You can detect a single partition of a table, but cannot perform the <strong id="EN-US_TOPIC_0000001188110538__b0799192792113">CASCADE</strong> operation on index tables.</li><li id="EN-US_TOPIC_0000001188110538__li1623314321502">HDFS tables (internal and foreign tables), temporary tables, and unlog tables are not supported.</li></ul>
|
|
</div></div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188110538__se1a50d2f13c64170a3c3eaed76afc87e"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001188110538__u58f57b17a7514b9b96ffcc17226c09fe"><li id="EN-US_TOPIC_0000001188110538__lc33d71832aac48f2bb3cebf785daf438"><strong id="EN-US_TOPIC_0000001188110538__ae34707dc644d4b28b2e27df45b848dd6">VERBOSE</strong><p id="EN-US_TOPIC_0000001188110538__a06936f949098489eb095f638cf1e132c">Enables the display of progress messages.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001188110538__n4672b2c65e3a4092afdbb0ac171fcfeb"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188110538__a9d0abe2cad43433790a6569185d1b041">If this parameter is specified, progress information is displayed by <strong id="EN-US_TOPIC_0000001188110538__b842352706214442">ANALYZE</strong> to indicate the table that is being processed, and statistics about the table are printed.</p>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__lb2f679266bfb40a79ff07368e301de5e"><strong id="EN-US_TOPIC_0000001188110538__a6679df15933a4026b27580ed07a4c986">table_name</strong><p id="EN-US_TOPIC_0000001188110538__a077487c7f22940b9b8a5583cb63ceed4">Specifies the name (possibly schema-qualified) of a specific table to analyze. If omitted, all regular tables (but not foreign tables) in the current database are analyzed.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__p613253554917">Currently, you can use <strong id="EN-US_TOPIC_0000001188110538__b89791359154210">ANALYZE</strong> to collect statistics about row-store tables, column-store tables, HDFS tables, ORC- or CARBONDATA-formatted OBS foreign tables, and foreign tables for collaborative analysis.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__ae790663addd14144986db7b8185f44f5">Value range: an existing table name</p>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__l5ba9943168ee4274af4bb20829a06482"><strong id="EN-US_TOPIC_0000001188110538__b1031482519313">column_name</strong>, <strong id="EN-US_TOPIC_0000001188110538__b113151725634">column_1_name</strong>, <strong id="EN-US_TOPIC_0000001188110538__b13315172519310">column_2_name</strong><p id="EN-US_TOPIC_0000001188110538__a4e49bf3babfe4d2f82d335e3bf4edb2d">Specifies the name of a specific column to analyze. All columns are analyzed by default.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__af5c15205dbda427c99b3e121aee10e9c">Value range: an existing column name</p>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__l5efebcde11bc492e806278819e34f6a6"><strong id="EN-US_TOPIC_0000001188110538__aaf7b474c3f38422694b9e0700105f6c3">partition_name</strong><p id="EN-US_TOPIC_0000001188110538__aa579aa94f21f4beaa0d51f58d53ab2a3">Assumes the table is a partitioned table. You can specify <strong id="EN-US_TOPIC_0000001188110538__b842352706154052">partition_name</strong> following the keyword <strong id="EN-US_TOPIC_0000001188110538__b842352706154150">PARTITION</strong> to analyze the statistics of this table. Currently the partitioned table supports the syntax of analyzing a partitioned table, but does not execute this syntax.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__ac1eac511c31b403a95378e4f00206632">Value range: a partition name in a table</p>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__l6b053651fb4148ad8a3f200c83e7b2ad"><strong id="EN-US_TOPIC_0000001188110538__a0cf84e20c16c46358f026b389256f82d">foreign_table_name</strong><p id="EN-US_TOPIC_0000001188110538__a19d68a7b00a841229a71746aa5f97ae4">Specifies the name (possibly schema-qualified) of a specific table to analyze. The data of the table is stored in HDFS.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__a17f9bf5989c54da59b05f1aa8b19f3d0">Value range: an existing table name</p>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__lebfcdad1697542b3a36820cfecf95ee9"><strong id="EN-US_TOPIC_0000001188110538__a71002516fcc04c499dbbb3d648a3a3ef">FOREIGN TABLES</strong><p id="EN-US_TOPIC_0000001188110538__a790e093c79214cd78864f1ad08a36d8d">Analyzes HDFS foreign tables stored in HDFS and accessible to the current user.</p>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__li1582611110539"><strong id="EN-US_TOPIC_0000001188110538__b08261411145313">index_name</strong><p id="EN-US_TOPIC_0000001188110538__p1082612115532">Name of the index table to be analyzed. The name may contain the schema name.</p>
|
|
<p id="EN-US_TOPIC_0000001188110538__p168261611175317">Value range: an existing table name</p>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__li662712410437"><strong id="EN-US_TOPIC_0000001188110538__b13139182219115">FAST|COMPLETE</strong><p id="EN-US_TOPIC_0000001188110538__p962744114431">For row-store tables, the CRC and page header of row-store tables are verified in <strong id="EN-US_TOPIC_0000001188110538__b192561948102516">FAST</strong> mode. If the verification fails, an alarm is reported. In <strong id="EN-US_TOPIC_0000001188110538__b99105782519">COMPLETE</strong> mode, parse and verify the pointers and tuples of row-store tables. For column-store tables, the CRC and magic of column-store tables are verified in <strong id="EN-US_TOPIC_0000001188110538__b164188923715">FAST</strong> mode. If the verification fails, an alarm is reported. In <strong id="EN-US_TOPIC_0000001188110538__b241816911377">COMPLETE</strong> mode, parse and verify CU of column-store tables.</p>
|
|
</li><li id="EN-US_TOPIC_0000001188110538__li5629121144410"><strong id="EN-US_TOPIC_0000001188110538__b1764622511111">CASCADE</strong><p id="EN-US_TOPIC_0000001188110538__p462961184415">In <strong id="EN-US_TOPIC_0000001188110538__b2070143822720">CASCADE</strong> mode, all indexes of the current table are checked.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188110538__section61271533829"><h4 class="sectiontitle">Examples</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__screen824712315720"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
|
<span class="normal"> 2</span>
|
|
<span class="normal"> 3</span>
|
|
<span class="normal"> 4</span>
|
|
<span class="normal"> 5</span>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span>
|
|
<span class="normal">11</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="k">IF</span><span class="w"> </span><span class="k">EXISTS</span><span class="w"> </span><span class="n">CUSTOMER</span><span class="p">;</span>
|
|
<span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">CUSTOMER</span>
|
|
<span class="p">(</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">C_CUSTKEY</span><span class="w"> </span><span class="nb">BIGINT</span><span class="w"> </span><span class="k">NOT</span><span class="w"> </span><span class="k">NULL</span><span class="w"> </span><span class="k">CONSTRAINT</span><span class="w"> </span><span class="n">C_CUSTKEY_pk</span><span class="w"> </span><span class="k">PRIMARY</span><span class="w"> </span><span class="k">KEY</span><span class="w"> </span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">C_NAME</span><span class="w"> </span><span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">25</span><span class="p">)</span><span class="w"> </span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">C_ADDRESS</span><span class="w"> </span><span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">40</span><span class="p">)</span><span class="w"> </span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">C_NATIONKEY</span><span class="w"> </span><span class="nb">INT</span><span class="w"> </span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">C_PHONE</span><span class="w"> </span><span class="nb">CHAR</span><span class="p">(</span><span class="mi">15</span><span class="p">)</span><span class="w"> </span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">C_ACCTBAL</span><span class="w"> </span><span class="nb">DECIMAL</span><span class="p">(</span><span class="mi">15</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span><span class="w"> </span>
|
|
<span class="p">)</span>
|
|
<span class="n">DISTRIBUTE</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">HASH</span><span class="p">(</span><span class="n">C_CUSTKEY</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<div class="p" id="EN-US_TOPIC_0000001188110538__p113416617173">Do <strong id="EN-US_TOPIC_0000001188110538__b775816102370">ANALYZE</strong> to update statistics in the <strong id="EN-US_TOPIC_0000001188110538__b375801016379">customer_info</strong> table:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__screen1812815330216"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ANALYZE</span><span class="w"> </span><span class="n">CUSTOMER</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="p" id="EN-US_TOPIC_0000001188110538__p1668317319176">Do <strong id="EN-US_TOPIC_0000001188110538__b3119131313716">ANALYZE VERBOSE</strong> to update statistics and display table information in the <strong id="EN-US_TOPIC_0000001188110538__b711901353716">customer_info</strong> table:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110538__screen61283331825"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ANALYZE</span><span class="w"> </span><span class="k">VERBOSE</span><span class="w"> </span><span class="n">CUSTOMER</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0242.html">DCL Syntax</a></div>
|
|
</div>
|
|
</div>
|
|
|