doc-exports/docs/dws/dev/dws_06_0195.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

38 lines
6.3 KiB
HTML

<a name="EN-US_TOPIC_0000001233430135"></a><a name="EN-US_TOPIC_0000001233430135"></a>
<h1 class="topictitle1">DROP INDEX</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001233430135__sf9f6ca2c092e4deeaf97e42ac59a5b1d"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001233430135__a8a043063e75e4c12b1a81f4e83e82dc5"><strong id="EN-US_TOPIC_0000001233430135__b842352706175534">DROP INDEX</strong> deletes an index.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430135__s4c4e83681b334aad9ecedd4cb1b34fcd"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001233430135__a137450f16cd141f19445b0b850530d82">Only the owner of an index or a system administrator can run <strong id="EN-US_TOPIC_0000001233430135__b842352706175926">DROP INDEX</strong> command.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430135__sd8b12fdfb0064165a69836a2505808d2"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233430135__s0025e4b279e44cee94c8b5f840b264cf"><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">DROP</span><span class="w"> </span><span class="k">INDEX</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="n">CONCURRENTLY</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">[</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="p">]</span><span class="w"> </span>
<span class="w"> </span><span class="n">index_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="k">CASCADE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">RESTRICT</span><span class="w"> </span><span class="p">];</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430135__s4724784f2f48418aac36ecc1a821c9ec"><h4 class="sectiontitle">Parameters</h4><ul id="EN-US_TOPIC_0000001233430135__u5222f9dd8fa74aabba5fbc4443040125"><li id="EN-US_TOPIC_0000001233430135__li02351314145411"><strong id="EN-US_TOPIC_0000001233430135__b15521621205416">CONCURRENTLY</strong><p id="EN-US_TOPIC_0000001233430135__p016810153544">Deletes an index without locking concurrent selections, inserts, updates, and deletes on the index table. A normal <strong id="EN-US_TOPIC_0000001233430135__b722119130910">DROP INDEX</strong> obtains an exclusive lock on the table to prevent other access until the index is deleted. With this option, the command waits until the conflicting transaction is complete.</p>
<p id="EN-US_TOPIC_0000001233430135__p51681215165418">Note that only one index name can be specified and the <strong id="EN-US_TOPIC_0000001233430135__b5471408165">CASCADE</strong> option is not supported. (Therefore, indexes that support <strong id="EN-US_TOPIC_0000001233430135__b673319177167">UNIQUE</strong> or <strong id="EN-US_TOPIC_0000001233430135__b14719172071619">PRIMARY KEY</strong> constraints cannot be deleted in this way.) Regular <strong id="EN-US_TOPIC_0000001233430135__b1917503114168">DROP INDEX</strong> commands can be executed within a transaction block, but cannot be executed in <strong id="EN-US_TOPIC_0000001233430135__b1492114581617">DROP INDEX CONCURRENTLY</strong> mode.</p>
</li><li id="EN-US_TOPIC_0000001233430135__l15cafdea3ee74c1395a51e2f58032382"><strong id="EN-US_TOPIC_0000001233430135__afc6b78aaa37e4943a70aae191b04aec0">IF EXISTS</strong><p id="EN-US_TOPIC_0000001233430135__a9d48275234494b93876756f7536bd4af">Sends a notice instead of an error if the specified index does not exist.</p>
</li><li id="EN-US_TOPIC_0000001233430135__l9632328a6be7460398ddcf976818e369"><strong id="EN-US_TOPIC_0000001233430135__ac5b042613cfa4514bc9936e02a739439">index_name</strong><p id="EN-US_TOPIC_0000001233430135__a031ddd0db01e4185a656b99dba1f2fc5">Specifies the name of the index to be deleted.</p>
<p id="EN-US_TOPIC_0000001233430135__ad035afa698da4dcea0f5f194167577ff">Value range: An existing index.</p>
</li><li id="EN-US_TOPIC_0000001233430135__lb97b27595ee24f279ca04843bdb6fc8a"><strong id="EN-US_TOPIC_0000001233430135__a894405099a394c488f627c5d32729f5f">CASCADE | RESTRICT</strong><ul id="EN-US_TOPIC_0000001233430135__u448e5c87cc3943c092133ea49a0903a9"><li id="EN-US_TOPIC_0000001233430135__l135475f954b9442aa30fa6e9e037fc5a"><strong id="EN-US_TOPIC_0000001233430135__b944489017124">CASCADE</strong>: automatically deletes all objects that depend on the index to be deleted.</li><li id="EN-US_TOPIC_0000001233430135__l24d6876eff634c78ab1baf6f21fef890"><strong id="EN-US_TOPIC_0000001233430135__b2644398317124">RESTRICT</strong> (default): refuses to delete the index if any objects depend on it.</li></ul>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430135__sfd7c747597194b288d053bcdba1444bf"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001233430135__p158593101582">Delete the <strong id="EN-US_TOPIC_0000001233430135__b3771091733520">ds_ship_mode_t1_index2</strong> index:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233430135__screen66325466715"><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">DROP</span><span class="w"> </span><span class="k">INDEX</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">ds_ship_mode_t1_index2</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430135__safdd24b5540a4595919e605a8d3968a7"><h4 class="sectiontitle">Helpful Links</h4><p id="EN-US_TOPIC_0000001233430135__acc6f6a3d20a24d69afcc420714933117"><a href="dws_06_0128.html">ALTER INDEX</a>, <a href="dws_06_0165.html">CREATE INDEX</a></p>
</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>