doc-exports/docs/dws/dev/dws_06_0226.html
Lu, Huayi ef0ada5a59 DWS DEV 20240716 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-11-02 09:07:47 +00:00

78 lines
26 KiB
HTML

<a name="EN-US_TOPIC_0000001510161269"></a><a name="EN-US_TOPIC_0000001510161269"></a>
<h1 class="topictitle1">VACUUM</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001510161269__s5f7bdd0d4677446eaa64ae35d4e4368e"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001510161269__a780d55c706514bef9dbf326f1f30a4d4">Reclaims storage space occupied by tables or B-tree indexes. In normal database operation, rows that have been deleted are not physically removed from their table; they remain present until a <strong id="EN-US_TOPIC_0000001510161269__b1738963220409">VACUUM</strong> is done. Therefore, it is necessary to execute <strong id="EN-US_TOPIC_0000001510161269__b56508115015">VACUUM</strong> periodically, especially on frequently-updated tables.</p>
<p id="EN-US_TOPIC_0000001510161269__a179e79d60dad4271ba132f8b142a71a1"></p>
</div>
<div class="section" id="EN-US_TOPIC_0000001510161269__s7e5c0f0dc67f4d92bd42a90da65bdd56"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001510161269__u216339b873a44c2696c2ba1bc1de4585"><li id="EN-US_TOPIC_0000001510161269__li139421524202111">With no table specified, <strong id="EN-US_TOPIC_0000001510161269__b65171128220">VACUUM</strong> processes all the tables that the current user has permission to vacuum in the current database. With a table specified, <strong id="EN-US_TOPIC_0000001510161269__b1337720401027">VACUUM</strong> processes only that table.</li><li id="EN-US_TOPIC_0000001510161269__lfd3d3ab4e6d64da29c2a8fb4f099f397">To perform <strong id="EN-US_TOPIC_0000001510161269__b13962152404016">VACUUM</strong> on a table, you must be the owner of the table, granted with the <strong id="EN-US_TOPIC_0000001510161269__b09633247408">VACUUM</strong> permission on the table, or granted with the <strong id="EN-US_TOPIC_0000001510161269__b3964102444020">gs_role_vacuum_any</strong> role. By default, a system administrator has this permission. However, database owners are allowed to <strong id="EN-US_TOPIC_0000001510161269__b126961147191619">VACUUM</strong> all tables in their databases, except shared catalogs. (The restriction for shared catalogs means that a true database-wide <strong id="EN-US_TOPIC_0000001510161269__b6102617615442">VACUUM</strong> can only be executed by the system administrator). <strong id="EN-US_TOPIC_0000001510161269__b1236468015442">VACUUM</strong> skips over any tables that the calling user does not have the permission to vacuum.</li><li id="EN-US_TOPIC_0000001510161269__l9e21b7f61c554ad0b4973f9586fb6c02"><strong id="EN-US_TOPIC_0000001510161269__b4417326015442">VACUUM</strong> cannot be executed inside a transaction block.</li><li id="EN-US_TOPIC_0000001510161269__l383522e91af241e681662fecd8c60100">It is recommended that active production databases be vacuumed frequently (at least nightly), in order to remove dead rows. After adding or deleting a large number of rows, it might be a good idea to execute the <strong id="EN-US_TOPIC_0000001510161269__b6201502015442">VACUUM ANALYZE</strong> command for the affected table. This will update the system catalogs with the results of all recent changes, and allow the query planner to make better choices in planning queries.</li><li id="EN-US_TOPIC_0000001510161269__l2bab399527cd4b2fa97a2da4da801b80"><strong id="EN-US_TOPIC_0000001510161269__b50637766161821">FULL</strong> is recommended only in special scenarios. For example, you wish to physically narrow the table to decrease the occupied disk space after deleting most rows of a table. <strong id="EN-US_TOPIC_0000001510161269__b187018472162">VACUUM FULL</strong> usually shrinks more table size than <strong id="EN-US_TOPIC_0000001510161269__b15701134713161">VACUUM</strong>. If the physical space usage does not decrease after you run the command, check whether there are other active transactions (that have started before you delete data transactions and not ended before you run <strong id="EN-US_TOPIC_0000001510161269__b151151211151120">VACUUM FULL</strong>). If there are such transactions, run this command again when the transactions quit.</li><li id="EN-US_TOPIC_0000001510161269__l0a6727aa520e416082e887b896e61a99"><strong id="EN-US_TOPIC_0000001510161269__b6661830315442">VACUUM</strong> causes a substantial increase in I/O traffic, which might cause poor performance for other active sessions. Therefore, it is sometimes advisable to use the cost-based VACUUM delay feature.</li><li id="EN-US_TOPIC_0000001510161269__l9bade9059c964dd88290ec76ff1149e5">When <strong id="EN-US_TOPIC_0000001510161269__b6269381615442">VERBOSE</strong> is specified, <strong id="EN-US_TOPIC_0000001510161269__b2737343715442">VACUUM</strong> prints progress messages to indicate which table is currently being processed. Various statistics about the tables are printed as well. </li><li id="EN-US_TOPIC_0000001510161269__l0995fb8a8957452e9dd55c61e76e6780">When the option list is surrounded by parentheses, the options can be written in any order. If there are no brackets, the options must be given in the order displayed in the syntax.</li><li id="EN-US_TOPIC_0000001510161269__li17588174212372"><strong id="EN-US_TOPIC_0000001510161269__b1166919135258">VACUUM</strong> and <strong id="EN-US_TOPIC_0000001510161269__b136701913202513">VACUUM FULL</strong> clear deleted tuples after the delay specified by <strong id="EN-US_TOPIC_0000001510161269__b1167010136252">vacuum_defer_cleanup_age</strong>.</li><li id="EN-US_TOPIC_0000001510161269__li18270174310219"><strong id="EN-US_TOPIC_0000001510161269__b55386423413">VACUUM ANALYZE</strong> executes a VACUUM operation and then an ANALYZE operation for each selected table. This is a handy combination form for routine maintenance scripts.</li><li id="EN-US_TOPIC_0000001510161269__li879952162614">Plain <strong id="EN-US_TOPIC_0000001510161269__b3428328815015">VACUUM</strong> (without <strong id="EN-US_TOPIC_0000001510161269__b4011414415015">FULL</strong>) recycles space and makes it available for reuse. This form of the command can operate in parallel with normal reading and writing of the table, as an exclusive lock is not obtained. <strong id="EN-US_TOPIC_0000001510161269__b2548298015015">VACUUM FULL</strong> executes wider processing, including moving rows across blocks to compress tables so they occupy minimum number of disk blocks. This form is much slower and requires an exclusive lock on each table while it is being processed.</li><li id="EN-US_TOPIC_0000001510161269__li125798507388">When you do <strong id="EN-US_TOPIC_0000001510161269__b611412168320">VACUUM</strong> to a column-store table, the following operations are internally performed: data in the delta table is migrated to the primary table, and the delta and desc tables of the primary table are vacuumed. <strong id="EN-US_TOPIC_0000001510161269__b9269818183212">VACUUM</strong> does not reclaim the storage space of the delta table. To reclaim it, do <strong id="EN-US_TOPIC_0000001510161269__b14269618103217">VACUUM DELTAMERGE</strong> to the column-store table.</li><li id="EN-US_TOPIC_0000001510161269__li16984175473614">Running <strong id="EN-US_TOPIC_0000001510161269__b24176561202">VACUUM FULL</strong> on system catalogs can only be done when the database is offline. Otherwise, table locks, exceptions, and errors may occur.</li><li id="EN-US_TOPIC_0000001510161269__li1039564945512">If you perform VACUUM FULL when a long-running query accesses a system table, the long-running query may prevent VACUUM FULL from accessing the system table. As a result, the connection times out and an error is reported.</li><li id="EN-US_TOPIC_0000001510161269__li629385684114">Running <strong id="EN-US_TOPIC_0000001510161269__b1063637892103655">VACUUM FULL</strong> on a column-store partitioned table locks the table and its partitions.</li><li id="EN-US_TOPIC_0000001510161269__li880422581313">Running <strong id="EN-US_TOPIC_0000001510161269__b157374301318">VACUUM FULL</strong> on different system tables simultaneously may cause local deadlocks.</li><li id="EN-US_TOPIC_0000001510161269__li1246245516214">When a <strong id="EN-US_TOPIC_0000001510161269__b192919229415">VACUUM FULL</strong> operation is performed on a table, it triggers table rebuilding. During this rebuilding process, data is dumped into a new data file. Once the rebuilding is complete, the original file is deleted. However, it is important to note that if the table is large, the rebuilding process can consume a large disk space. When the disk space is insufficient, performing the <strong id="EN-US_TOPIC_0000001510161269__b58884908062343">VACUUM FULL</strong> operation on large tables may cause the cluster to become read-only.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001510161269__s4b75675b19e94f2495504d35844b9d8c"><h4 class="sectiontitle">Syntax</h4><ul id="EN-US_TOPIC_0000001510161269__u39b8a29fed5d4a5395afcc9a26478535"><li id="EN-US_TOPIC_0000001510161269__l88ef7230373c4283bf45744079953ecc">Reclaim space and update statistics. The keyword sequence must be given in the order in which the syntax is displayed.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__sd21f5016f55343f2836d700533a9cd51"><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="k">VACUUM</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="err">{</span><span class="w"> </span><span class="k">FULL</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">FREEZE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">VERBOSE</span><span class="w"> </span><span class="o">|</span><span class="w"> </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="w"> </span><span class="err">}}</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="k">table_name</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="p">(</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="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">partition_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>
</li><li id="EN-US_TOPIC_0000001510161269__l7ebe0c5a127344028b6dedb72126858b">Reclaim space, without updating statistics information.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__s3c5480df05c34bbdb1549263d1b502d5"><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">VACUUM</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">FULL</span><span class="w"> </span><span class="p">[</span><span class="n">COMPACT</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="k">FREEZE</span><span class="w"> </span><span class="p">]</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="n">PARTITION</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="n">partition_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>
</li><li id="EN-US_TOPIC_0000001510161269__l4ea7e71c9b174f669a3b044b14d48a14">Reclaim space and update statistics information, with a specific order of keywords required.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__s9ca41f0090ba42d0b8d94e564ecdab1c"><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="k">VACUUM</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">FULL</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">FREEZE</span><span class="w"> </span><span class="p">]</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="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="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="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="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">partition_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>
</li><li id="EN-US_TOPIC_0000001510161269__l3116df7d0a5348c3b9a0458b427d82fb">For HDFS tables, migrate data from the delta table to the primary table. The <strong id="EN-US_TOPIC_0000001510161269__b8540653052437">partition_name</strong> parameter is supported only by clusters of version 8.2.1.300 or later.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__s254c3369a8824ff9956f4c2beb7d0cdf"><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">VACUUM</span><span class="w"> </span><span class="n">DELTAMERGE</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="n">partition_name</span><span class="p">];</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001510161269__l5340ea229cd2495a8dd7c0e38b978bdf">For HDFS tables, delete the empty value partition directory of HDFS table in HDFS storage.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__screen624410348416"><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">VACUUM</span><span class="w"> </span><span class="n">HDFSDIRECTORY</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>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001510161269__se83e416dc0b242ca98b7568cca0d3721"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001510161269__uf0e23e064b1f4a23a7c36f51b83c6d9a"><li id="EN-US_TOPIC_0000001510161269__l524bf909d24d42a0889f9f4210f5c660"><strong id="EN-US_TOPIC_0000001510161269__a1bccac88dcf445c295e876f24440c9bd">FULL</strong><p id="EN-US_TOPIC_0000001510161269__a5bec58eb5e1248548f092ba85ca2f9f4">Selects "FULL" vacuum, which can reclaim more space, but takes much longer and exclusively locks the table.</p>
<p id="EN-US_TOPIC_0000001510161269__aa42be404223a48a49d7f76d2daaf1e08"><strong id="EN-US_TOPIC_0000001510161269__b842352706164957">FULL</strong> options can also contain the <strong id="EN-US_TOPIC_0000001510161269__b842352706165018">COMPACT</strong> parameter, which is only used for the HDFS table. Specifying the <strong id="EN-US_TOPIC_0000001510161269__b892175117112335">COMPACT</strong> parameter improves <strong id="EN-US_TOPIC_0000001510161269__b514019716112319">VACUUM FULL</strong> operation performance.</p>
<p id="EN-US_TOPIC_0000001510161269__ac90ba3677dbf483b9e3b40bbd9f54917"><strong id="EN-US_TOPIC_0000001510161269__b842352706165341">COMPACT</strong> and <strong id="EN-US_TOPIC_0000001510161269__b842352706165344">PARTITION</strong> cannot be used at the same time.</p>
<div class="note" id="EN-US_TOPIC_0000001510161269__n57895ae63892457d800aea87a40bf72d"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001510161269__a133139aecff44a10b80c73391a72e3b5">Using <strong id="EN-US_TOPIC_0000001510161269__b18651614151617">FULL</strong> will cause statistics missing. To collect statistics, add the keyword <strong id="EN-US_TOPIC_0000001510161269__b160011119172">ANALYZE</strong> to <strong id="EN-US_TOPIC_0000001510161269__b1185081913171">VACUUM FULL</strong>.</p>
</div></div>
</li><li id="EN-US_TOPIC_0000001510161269__l51b262d8b6b64691b133af48cea732ad"><strong id="EN-US_TOPIC_0000001510161269__a6e9340ced0084094a6ebdaced44baa1b">FREEZE</strong><p id="EN-US_TOPIC_0000001510161269__a58abd6b93c3e4697a898b75d057c04a8">Is equivalent to executing <strong id="EN-US_TOPIC_0000001510161269__b5005541115263">VACUUM</strong> with the <strong id="EN-US_TOPIC_0000001510161269__b2795648515263">vacuum_freeze_min_age</strong> parameter set to <strong id="EN-US_TOPIC_0000001510161269__b4988279915263">zero</strong>.</p>
</li><li id="EN-US_TOPIC_0000001510161269__l8c7d8b480e4b427ba07e95e817f58f57"><strong id="EN-US_TOPIC_0000001510161269__a88b01d5ef1904ee5b9ebddac91287d87">VERBOSE</strong><p id="EN-US_TOPIC_0000001510161269__a445bdae44d784b2ca1e86c0812f7ad85">Prints a detailed vacuum activity report for each table.</p>
</li><li id="EN-US_TOPIC_0000001510161269__l8bd1eb6b8d9a4be091b980ff32a5004a"><strong id="EN-US_TOPIC_0000001510161269__a3fee0c4c7ceb472dbe7fad548c89c656">ANALYZE | ANALYSE</strong><p id="EN-US_TOPIC_0000001510161269__a246e780aefda41d5a3052589f31d6245">Updates statistics used by the planner to determine the most efficient way to execute a query.</p>
</li><li id="EN-US_TOPIC_0000001510161269__l1ee21fb7ce8a4f0ea39040c12b3c58cd"><strong id="EN-US_TOPIC_0000001510161269__a885f61484dc44005a4c28eb72d84db29">table_name</strong><p id="EN-US_TOPIC_0000001510161269__ad467aa7239404197aa852226a39149c3">Indicates the name (optionally schema-qualified) of a specific table to vacuum.</p>
<p id="EN-US_TOPIC_0000001510161269__ac96f70dcd0cf43e988ca430aaed24ef4">Value range: The name of a specific table to vacuum. Defaults are all tables in the current database.</p>
</li><li id="EN-US_TOPIC_0000001510161269__l37a69e2ca3054404a702f6248fc8986a"><strong id="EN-US_TOPIC_0000001510161269__a846e9d4698074065a002ad3e6e1ce0bd">column_name</strong><p id="EN-US_TOPIC_0000001510161269__a0e6052d387de4ed0807902e51eff4869">Indicates the name of a specific field to analyze.</p>
<p id="EN-US_TOPIC_0000001510161269__a67e50e8ba0344c5fbc676abb00b57468">Value range: Indicates the name of a specific field to analyze. Defaults are all columns.</p>
</li><li id="EN-US_TOPIC_0000001510161269__l541d88b952e3461b8646e75f31ba15bc"><strong id="EN-US_TOPIC_0000001510161269__a18bf6d74016845a7823a354e5d67c1aa">PARTITION</strong><p id="EN-US_TOPIC_0000001510161269__p472132183611">HDFS tables do not support <strong id="EN-US_TOPIC_0000001510161269__b190215431952437">PARTITION</strong>. <strong id="EN-US_TOPIC_0000001510161269__b147539772952437">COMPACT</strong> and <strong id="EN-US_TOPIC_0000001510161269__b196973241752437">PARTITION</strong> cannot be used at the same time.</p>
<div class="note" id="EN-US_TOPIC_0000001510161269__note11898153111182"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001510161269__p88981031101819">The following error message will be displayed if <strong id="EN-US_TOPIC_0000001510161269__b139939953452437">PARTITION</strong> and <strong id="EN-US_TOPIC_0000001510161269__b87332085252437">COMPACT</strong> are both used: <strong id="EN-US_TOPIC_0000001510161269__b114511401152437">COMPACT can not be used with PARTITION</strong>.</p>
</div></div>
</li><li id="EN-US_TOPIC_0000001510161269__lb45a48b077ef4938aa8e27258f330009"><strong id="EN-US_TOPIC_0000001510161269__a39f9f7f6a0dc4547831d898d6d2030eb">partition_name</strong><p id="EN-US_TOPIC_0000001510161269__a71e10e8f0fad44068e7157c014b747dc">Indicates the partition name of a specific table to vacuum. Defaults are all partitions.</p>
</li><li id="EN-US_TOPIC_0000001510161269__l39da84c8002046578a19e9c44ca4f025"><strong id="EN-US_TOPIC_0000001510161269__a8dc44d683b564b13a31a144b298b53d8">DELTAMERGE</strong><p id="EN-US_TOPIC_0000001510161269__ab4de1ceec20b46d6901f5c3762f66994">(For HDFS tables) Migrates data from the delta table to primary tables. If the data volume of the delta table is less than 60,000 rows, the data will not be migrated. Otherwise, the data will be migrated to HDFS, and the delta table will be cleared by <strong id="EN-US_TOPIC_0000001510161269__b12490613142218">TRUNCATE</strong>. </p>
</li><li id="EN-US_TOPIC_0000001510161269__leb71aec9ff894fe59875a6eb504d9b21"><strong id="EN-US_TOPIC_0000001510161269__a2f797b6c271c4025bbc29fc9eea5ecbc">HDFSDIRECTORY</strong><p id="EN-US_TOPIC_0000001510161269__a8aa91fe0414e48b4b43eb784e23a8bca">Deletes the empty value partition directory of HDFS table in HDFS storage for HDFS table.</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001510161269__s12262122d2d24f618cc6d20821bd0807"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001510161269__p12649163574715">Delete all tables in the current database.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__screen8649133511474"><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">VACUUM</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001510161269__p18386141217413">Reclaim the space of partition <strong id="EN-US_TOPIC_0000001510161269__b929214319402">P2</strong> of the <strong id="EN-US_TOPIC_0000001510161269__b029453114409"><span id="EN-US_TOPIC_0000001510161269__text1829383117400">tpcds.</span>web_returns_p1</strong> table without updating statistics.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__screen6130652195011"><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">VACUUM</span><span class="w"> </span><span class="k">FULL</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">web_returns_p1</span><span class="w"> </span><span class="n">PARTITION</span><span class="p">(</span><span class="n">P2</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001510161269__p10560366269">Reclaim the space of the <strong id="EN-US_TOPIC_0000001510161269__b84414915385"><span id="EN-US_TOPIC_0000001510161269__text3441189143815">tpcds.</span>web_returns_p1</strong> table and update statistics.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__screen1392110247263"><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">VACUUM</span><span class="w"> </span><span class="k">FULL</span><span class="w"> </span><span class="k">ANALYZE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">web_returns_p1</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001510161269__p964912356478">Delete all tables in the current database and collect statistics about the query optimizer.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__screen19649163517472"><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">VACUUM</span><span class="w"> </span><span class="k">ANALYZE</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001510161269__p1464993511478">Delete only the <strong id="EN-US_TOPIC_0000001510161269__b15539185810385">reason</strong> table.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510161269__screen3649835124710"><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">VACUUM</span><span class="w"> </span><span class="p">(</span><span class="k">VERBOSE</span><span class="p">,</span><span class="w"> </span><span class="k">ANALYZE</span><span class="p">)</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0118.html">DDL Syntax</a></div>
</div>
</div>