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>
328 lines
44 KiB
HTML
328 lines
44 KiB
HTML
<a name="EN-US_TOPIC_0000001510400945"></a><a name="EN-US_TOPIC_0000001510400945"></a>
|
|
|
|
<h1 class="topictitle1">LOCK</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001510400945__secc275dadf0d45e5a345ba787b8ce30f"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001510400945__af1c1e6bac5774044884a4e7887a1fff5"><strong id="EN-US_TOPIC_0000001510400945__en-us_topic_0085032098_b5959255010396">LOCK TABLE</strong> obtains a table-level lock.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__p1974634515810">When the lock for commands referencing a table is automatically acquired, <span id="EN-US_TOPIC_0000001510400945__text59485065620">GaussDB(DWS)</span> always uses the lock mode with minimum constraints. Use <strong id="EN-US_TOPIC_0000001510400945__b136915608752313">LOCK</strong> if a more strict lock mode is needed. For example, suppose an application runs a transaction at the <strong id="EN-US_TOPIC_0000001510400945__b22270398952313">Read Committed</strong> isolation level and needs to ensure that data in a table remains stable in the duration of the transaction. To achieve this, you could obtain <strong id="EN-US_TOPIC_0000001510400945__b144677429570">SHARE</strong> lock mode over the table before the query. This will prevent concurrent data changes and ensure subsequent reads of the table see a stable view of committed data. It is because the <strong id="EN-US_TOPIC_0000001510400945__b13111240583">SHARE</strong> lock mode conflicts with the <strong id="EN-US_TOPIC_0000001510400945__b151112435810">ROW EXCLUSIVE</strong> lock acquired by writers, and your <strong id="EN-US_TOPIC_0000001510400945__b15111224145818">LOCK TABLE name IN SHARE MODE</strong> statement will wait until any concurrent holders of <strong id="EN-US_TOPIC_0000001510400945__b121122445815">ROW EXCLUSIVE</strong> mode locks commit or roll back. Therefore, once you obtain the lock, there are no uncommitted writes outstanding; furthermore none can begin until you release the lock.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001510400945__sf9eefb58a1ce405fb2a6863e50a3ef9d"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001510400945__u4d2844876e9f46cba2c78becb18ae515"><li id="EN-US_TOPIC_0000001510400945__l68fd7cc558bf4562973c0e6367ffa254"><strong id="EN-US_TOPIC_0000001510400945__b13350347184011">LOCK TABLE</strong> is useless outside a transaction block: the lock would remain held only to the completion of the statement. If <strong id="EN-US_TOPIC_0000001510400945__b84235270615938">LOCK TABLE</strong> is out of any transaction block, an error is reported.</li><li id="EN-US_TOPIC_0000001510400945__l9af822d99b5d486fa031c125573e8385">If no lock mode is specified, then <strong id="EN-US_TOPIC_0000001510400945__b10140957103929">ACCESS EXCLUSIVE</strong>, the most restrictive mode, is used.</li><li id="EN-US_TOPIC_0000001510400945__l50300fd05adc4133821fc6fb035f102b">LOCK TABLE ... IN ACCESS SHARE MODE requires the <strong id="EN-US_TOPIC_0000001510400945__b84235270611446">SELECT</strong> permission on the target table. All other forms of <strong id="EN-US_TOPIC_0000001510400945__b29940201103929">LOCK</strong> require table-level <strong id="EN-US_TOPIC_0000001510400945__b1026358103929">UPDATE</strong> and/or the <strong id="EN-US_TOPIC_0000001510400945__b9237230103929">DELETE</strong> permission.</li><li id="EN-US_TOPIC_0000001510400945__l013cd77dce314591861fda5461eca698">There is no <strong id="EN-US_TOPIC_0000001510400945__b10018151103929">UNLOCK TABLE</strong> command. Locks are always released at transaction end.</li><li id="EN-US_TOPIC_0000001510400945__l12edee3375454c7a9d650d88fec1bc79"><strong id="EN-US_TOPIC_0000001510400945__b9380343184023">LOCK TABLE</strong> only deals with table-level locks, and so the mode names involving <strong id="EN-US_TOPIC_0000001510400945__b29513943103929">ROW</strong> are all misnomers. These mode names should generally be read as indicating the intention of the user to acquire row-level locks within the locked table. Also, <strong id="EN-US_TOPIC_0000001510400945__en-us_topic_0085032098_b64298897103929">ROW EXCLUSIVE</strong> mode is a shareable table lock. Keep in mind that all the lock modes have identical semantics so far as <strong id="EN-US_TOPIC_0000001510400945__en-us_topic_0085032098_b41819165103929">LOCK TABLE</strong> is concerned, differing only in the rules about which modes conflict with which. For details about the rules, see <a href="#EN-US_TOPIC_0000001510400945__tec3c848278c344f9a15c8ab751ad98d7">Table 1</a>.</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001510400945__s51f69d8bcfe34440bd5456b8286cb7ec"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510400945__s64b55902ede44489a2bdd6eeea5bf399"><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="k">LOCK</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="err">{</span><span class="p">[</span><span class="w"> </span><span class="k">ONLY</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...]</span><span class="o">|</span><span class="w"> </span><span class="err">{</span><span class="n">name</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="p">]</span><span class="err">}</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...]</span><span class="err">}</span>
|
|
<span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">IN</span><span class="w"> </span><span class="err">{</span><span class="k">ACCESS</span><span class="w"> </span><span class="k">SHARE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ROW</span><span class="w"> </span><span class="k">SHARE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ROW</span><span class="w"> </span><span class="k">EXCLUSIVE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">SHARE</span><span class="w"> </span><span class="k">UPDATE</span><span class="w"> </span><span class="k">EXCLUSIVE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">SHARE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">SHARE</span><span class="w"> </span><span class="k">ROW</span><span class="w"> </span><span class="k">EXCLUSIVE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">EXCLUSIVE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ACCESS</span><span class="w"> </span><span class="k">EXCLUSIVE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">UPDATE</span><span class="w"> </span><span class="k">EXCLUSIVE</span><span class="err">}</span><span class="w"> </span><span class="k">MODE</span><span class="w"> </span><span class="p">]</span>
|
|
<span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="n">NOWAIT</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="k">LOCAL</span><span class="w"> </span><span class="n">COORDINATOR</span><span class="w"> </span><span class="k">ONLY</span><span class="p">];</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001510400945__sd41f320125df4d189e342d377733aa28"><h4 class="sectiontitle">Parameter Description</h4>
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001510400945__tec3c848278c344f9a15c8ab751ad98d7"></a><a name="tec3c848278c344f9a15c8ab751ad98d7"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001510400945__tec3c848278c344f9a15c8ab751ad98d7" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Lock mode conflicts</caption><thead align="left"><tr id="EN-US_TOPIC_0000001510400945__re62255242b034ae287ea38ae49d6810a"><th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.1"><p id="EN-US_TOPIC_0000001510400945__a4ff167915bc44db8bade47929ab9dd80">Requested Lock Mode/Current Lock Mode</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.2"><p id="EN-US_TOPIC_0000001510400945__a815c5a7aafbc4963bd1b784e69c5dedb">ACCESS SHARE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.3"><p id="EN-US_TOPIC_0000001510400945__addeace858ab245f4914e914d9c8fd2e9">ROW SHARE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.4"><p id="EN-US_TOPIC_0000001510400945__ac03b638462e346378d7b1e34779f80ae">ROW EXCLUSIVE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.5"><p id="EN-US_TOPIC_0000001510400945__a2013bce63bf24cc8951bdb1662c9042a">SHARE UPDATE EXCLUSIVE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.6"><p id="EN-US_TOPIC_0000001510400945__a1614623de84c4d38a8bd2ace69e9d99c">SHARE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.7"><p id="EN-US_TOPIC_0000001510400945__a4552f3d4bcc848fabf9e4f333cd048cc">SHARE ROW EXCLUSIVE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.8"><p id="EN-US_TOPIC_0000001510400945__a5670f06dfb2444b29a14f7c6e75197ae">EXCLUSIVE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="10.275889644142344%" id="mcps1.3.4.2.2.11.1.9"><p id="EN-US_TOPIC_0000001510400945__a0691b3f7c2d7454b817077c0f5e837d5">ACCESS EXCLUSIVE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="7.516993202718913%" id="mcps1.3.4.2.2.11.1.10"><p id="EN-US_TOPIC_0000001510400945__p467134772620">UPDATE EXCLUSIVE</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001510400945__rd459bf964e6245989727d5ac235c902e"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__a86f93d698d2840ec888ef730a05cbd3a">ACCESS SHARE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__ad41f1449da704d828a8dcc205e5a9358">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__a473145a94f31448eb0281f0ead8ec1f4">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__af758125ed2a74e699f75b66dd6202c6b">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__aa2c9eac45826401b80366ae7c894b7cc">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__a20fa6451966442568a041e06e6be02c1">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__ad4947f9a73534e7b9a43d268af89e552">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__a9ebe196ed6d6427faf4a35b859803361">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__a50363cfc97c047b7b145ad6fe0b3d840">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p191091147172812">-</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001510400945__r97b0eec40b424ed58c2cc49b08da52e2"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__adcd818e2fe95444abc63f8e48c3b2fab">ROW SHARE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__af4640253b568448d97a01d264351d20b">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__a3af0a0a5bad24e6ea2807bdda2244541">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__ae3df7421e626422b963933ab860fc6e1">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__a11767e0a0bbc4a31ad0b41ff34a5669d">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__a92bf226349354b2cac554ebe368f637c">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__a59f8aaad96de43ca9220fb6a2fd6ae68">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__a081c0760feee4e83a33ab5999295d409">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__a5760137abe2e43e4938e920bb67ff42a">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p91094477282">-</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001510400945__r375b35fcb8304f6aa5cd513565d7ebfb"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__af72653b3dd7e4feca6ed445ae5955dab">ROW EXCLUSIVE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__aeacfdaf7d0ad42b3b55945e86892ecb1">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__a5140fca54ef44c42aa381d874228fe11">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__ab70501b6903447e38821bb049c7eafcc">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__a1e2372efe2444628a14adae5f96dee97">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__a015010fb4b5945f3a1fb458f18425f1b">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__a9526e5e2417f414ca9b4892910d324a1">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__a83b926fad30743d09887951d88880412">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__a68dfd6da36864bf79518d047cad399b4">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p110915476288">-</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001510400945__rc8f85543b5754a5d9cbdf8ea0a4acc7b"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__a0f08ba0db1ba43aba98d04c6f63a8fb3">SHARE UPDATE EXCLUSIVE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__a745235e8b2ee4cf090f63331e5cd83c2">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__a75bc0709636c4424aabfdfde656f4abf">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__ad8a81978255a452e99d3379465889700">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__ae167ca3d219449749135b2bd1ff658b8">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__a855ac35af79e4d36b00315ce08498d91">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__a82d97a3804874c25a09e31a6fa795882">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__abfbdb9abf0ae41289c897a7730b63ba5">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__ae721c026e5e54ad28602fdb401aa0f6b">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p81091547132810">-</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001510400945__r1021bfc6ce4943dcbda3565d01778d76"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__abb00d86aff8e4002b6ca7cd17207591a">SHARE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__a3a93d5aa6a8c4ac984d1f4939d5e7524">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__a4e8d9be1411d4534bd6dd91d61ace163">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__a5c3275589836443298ec02cdb34f9287">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__a70c9bb04f6e846c0bf711b2bf893f699">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__a080200cb62dd42f59b0cb80feb910536">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__abf9fa217bb614b55860a7f1c26f2e698">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__aa9fc024501bf4d128a0040ad9b800799">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__ad6249f10dbbd4b6ea6dd828406199fdd">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p3109747152811">X</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001510400945__r1e606e7b9d614c508149a06ee003f7ca"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__a583bbafa61e34530a8935b8486d3aa25">SHARE ROW EXCLUSIVE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__a773d72276f8244eabb813943d674b8b1">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__a842cd0f53a4e41188023878d390f10e4">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__a1bd646ec6de24086a393df1082093a8f">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__a8dcedc41fdc742738e2078bbaa78093b">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__a28187f915b9d461dbe2b455133349e64">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__a4c00bd5291a542869e7987b0068465ee">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__a2b54835664154db2bafb796d31c32b00">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__a0d526e22113844609b22fdba302b0960">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p8110147102818">X</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001510400945__r5c7c3455618841d09a836a9835df9a94"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__a506cbe83d9b04a65a64a7b85525281fa">EXCLUSIVE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__ac47c1ceb27154c64bf5be46407acdc9c">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__a7c8ffbd83fa24ca68a27155e0e2bc5ec">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__aef10acc737984e67af0a3dfce99e6676">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__ad156d01aa44b48cda82dfe5349715eab">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__a946fdc91070d43769c65fbc7db1cee22">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__a6ffab005b53c4528ad72acdc4d073eb8">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__a790493265b1a4cb3b3d4196f47b01858">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__ad0fa91730f5944df8d2901dfd4608899">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p14110174710281">X</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001510400945__r9f818fb0092f47e583ac704cae8e91bd"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__a4c01802b0ad749e4b4d607d1c6226836">ACCESS EXCLUSIVE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__ac48a0f2b417c4d25b65406afc7e4a1fe">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__a3918eed528e24ecc89c5881ad3d37860">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__a9c6d9f01e7f64166b4c83f53d1ae3560">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__aa8ab6c60859f4a6491f24fc9720bd5a0">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__a790339bb6f3d40a185a4c2963adb5f8f">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__a2d417c9b64aa4d3a8c01dfd3be643f70">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__a067d1cba08a147d2b49c14e6e593ffbf">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__a296cc060a1a1438b97448f6a3670aca7">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p11103479283">X</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001510400945__row791552513293"><td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.1 "><p id="EN-US_TOPIC_0000001510400945__p1485123492910">UPDATE EXCLUSIVE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.2 "><p id="EN-US_TOPIC_0000001510400945__p18146144192919">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.3 "><p id="EN-US_TOPIC_0000001510400945__p13146644152916">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.4 "><p id="EN-US_TOPIC_0000001510400945__p11146344192910">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.5 "><p id="EN-US_TOPIC_0000001510400945__p2146124482912">-</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.6 "><p id="EN-US_TOPIC_0000001510400945__p14146114410291">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.7 "><p id="EN-US_TOPIC_0000001510400945__p7146144414295">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.8 "><p id="EN-US_TOPIC_0000001510400945__p5147174412295">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="10.275889644142344%" headers="mcps1.3.4.2.2.11.1.9 "><p id="EN-US_TOPIC_0000001510400945__p141475445293">X</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.516993202718913%" headers="mcps1.3.4.2.2.11.1.10 "><p id="EN-US_TOPIC_0000001510400945__p7147184492916">X</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001510400945__ab1c489b11c6c45c09bafb0d8e5af18a5"><strong id="EN-US_TOPIC_0000001510400945__b842352706151327">LOCK</strong> parameters are as follows:</p>
|
|
<ul id="EN-US_TOPIC_0000001510400945__u44cb9d7c744c475e94a94548bd7e2293"><li id="EN-US_TOPIC_0000001510400945__lc4d3b29bca214421a879891577b725fc"><strong id="EN-US_TOPIC_0000001510400945__a24f648d7d29d46dc82120c1b0ec6a4b1">name</strong><p id="EN-US_TOPIC_0000001510400945__a455b47425dc444ad8b8da356ba119cc6">The name (optionally schema-qualified) of an existing table to lock.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__aac98498f89ca44f387cf2fc9f3369c98">The tables are locked one-by-one in the order specified in the <strong id="EN-US_TOPIC_0000001510400945__b63540875183935">LOCK TABLE</strong> command.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__a11b00975dc4c4c078ce48c3e4c54c9a5">Value range: an existing table name</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__l8bec973bb9bb46e797c145c46b7632e5"><strong id="EN-US_TOPIC_0000001510400945__a41cabc8426524fe888ab474d16b3eff9">ONLY</strong><p id="EN-US_TOPIC_0000001510400945__a1546ce5095974da9bcf8e6245e12da89"><strong id="EN-US_TOPIC_0000001510400945__b60504204183935">Only</strong> locks only this table. If <strong id="EN-US_TOPIC_0000001510400945__b7666932183935">Only</strong> is not specified, this table and all its sub-tables are locked.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__l028de87d006a494aac97ddc447614025"><strong id="EN-US_TOPIC_0000001510400945__ab43c4fb509984e14acf937730265a2f3">ACCESS SHARE</strong><p id="EN-US_TOPIC_0000001510400945__a7f8a6d27520540a2a1076bc476c7455b"><strong id="EN-US_TOPIC_0000001510400945__b0469739102513">ACCESS SHARE</strong> allows only read operations on a table. In general, any SQL statements that only read a table and do not modify it will acquire this lock mode. The <strong id="EN-US_TOPIC_0000001510400945__b55414293183935">SELECT</strong> command acquires a lock of this mode on referenced tables.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__ldfe125c54faa4fcdb0ff5c59c05fb4ce"><strong id="EN-US_TOPIC_0000001510400945__acc1e750f95a54a16af0d5735e2841df0">ROW SHARE</strong><p id="EN-US_TOPIC_0000001510400945__a53fd059dbf0b405bbce30e446e324ab2"><strong id="EN-US_TOPIC_0000001510400945__b126977234433715">ROW SHARE</strong> allows concurrent read of a table but does not allow any other operations on the table.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__a0e8b2eb5578c40c2a3fa577fa09ce992"><strong id="EN-US_TOPIC_0000001510400945__b45118082833715">SELECT FOR UPDATE</strong> and <strong id="EN-US_TOPIC_0000001510400945__b3802849933715">SELECT FOR SHARE</strong> automatically acquire the <strong id="EN-US_TOPIC_0000001510400945__b48890460433715">ROW SHARE</strong> lock on the target table and add the <strong id="EN-US_TOPIC_0000001510400945__b62630863533715">ACCESS SHARE</strong> lock to other referenced tables except <strong id="EN-US_TOPIC_0000001510400945__b47402782833715">FOR SHARE</strong> and <strong id="EN-US_TOPIC_0000001510400945__b101526597133715">FOR UPDATE</strong>.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__lbd4ab20ac345466ab4e64b07c662a884"><strong id="EN-US_TOPIC_0000001510400945__a5866672017174cbaac8a061f8c7a90af">ROW EXCLUSIVE</strong><p id="EN-US_TOPIC_0000001510400945__abe36bb977f2049ddac4f53426a3be092">Like <strong id="EN-US_TOPIC_0000001510400945__b169535420214">ROW SHARE</strong>, <strong id="EN-US_TOPIC_0000001510400945__b1795155418212">ROW EXCLUSIVE</strong> allows concurrent read of a table and modification of data in the table. <strong id="EN-US_TOPIC_0000001510400945__b115553984133715">UPDATE</strong>, <strong id="EN-US_TOPIC_0000001510400945__b192185404933715">DELETE</strong>, and <strong id="EN-US_TOPIC_0000001510400945__b44150899533715">INSERT</strong> automatically acquire the <strong id="EN-US_TOPIC_0000001510400945__b46911376333715">ROW SHARE</strong> lock on the target table and add the <strong id="EN-US_TOPIC_0000001510400945__b158228875933715">ACCESS SHARE</strong> lock to other referenced tables. Generally, all commands that modify table data acquire the <strong id="EN-US_TOPIC_0000001510400945__b209360455833715">ROW EXCLUSIVE</strong> lock for tables.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__l6d4912192e4046d587267d2acab50c16"><strong id="EN-US_TOPIC_0000001510400945__a543a14fba3a94d4d9e9b6618e41ee585">SHARE UPDATE EXCLUSIVE</strong><p id="EN-US_TOPIC_0000001510400945__a3cb9e999803746629df501165b8c3913">This mode protects a table against concurrent schema changes and VACUUM runs.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__a36400251c8c34cc2841bac0adec0b741">Acquired by VACUUM (without FULL), ANALYZE, CREATE INDEX CONCURRENTLY, and some forms of ALTER TABLE.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__lda547306cbf84840a70b83c8539c810f"><strong id="EN-US_TOPIC_0000001510400945__a66cebbb0e7ec49e9aef91b8c426dde71">SHARE</strong><p id="EN-US_TOPIC_0000001510400945__a0230733fe7f34bbda7e4c7f34850c0be"><strong id="EN-US_TOPIC_0000001510400945__b30316646033715">SHARE</strong> allows concurrent queries of a table but does not allow modification of the table.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__a8dc36034496f47c0a6edaac7e60896b9">Acquired by CREATE INDEX (without CONCURRENTLY).</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__lcbabb9162e2249368dfaca9a75573295"><strong id="EN-US_TOPIC_0000001510400945__a8f655e6538d6470583a221f3f7dd3940">SHARE ROW EXCLUSIVE</strong><p id="EN-US_TOPIC_0000001510400945__a5cb9409d14264294b2ca73ab1049cab4"><strong id="EN-US_TOPIC_0000001510400945__b136623700533715">SHARE ROW EXCLUSIVE</strong> protects a table against concurrent data changes, and is self-exclusive so that only one session can hold it at a time.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__aa9efbc2538e641358513866d7555114d">No SQL statements automatically acquire this lock mode.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__l51ae488ae4194fcc9f245533cd3f7943"><strong id="EN-US_TOPIC_0000001510400945__a188ce7ee0eb74542b4ea707d9ce8bd78">EXCLUSIVE</strong><p id="EN-US_TOPIC_0000001510400945__a2ac2d0d256a140f2974f438dcb78511e"><strong id="EN-US_TOPIC_0000001510400945__b167862048533715">EXCLUSIVE</strong> allows concurrent queries of the target table but does not allow any other operations.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__abfbdc914843f4432a3945d57ed04a3ca">This mode allows only concurrent <strong id="EN-US_TOPIC_0000001510400945__b114325526733715">ACCESS SHARE</strong> locks; that is, only reads from the table can proceed in parallel with a transaction holding this lock mode.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__a72fcbc15ef2a4e29ba036e2fae7ea46a">No SQL statements automatically acquire this lock mode on user tables. However, it will be acquired on some system tables in case of some operations.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__lfb381ffaa64d47e99aa6b73fc2aebc3b"><strong id="EN-US_TOPIC_0000001510400945__a0f9995511f174af48ffc07ec235a3f5d">ACCESS EXCLUSIVE</strong><p id="EN-US_TOPIC_0000001510400945__a7d2cf6715b6c4ee0a68e5e7d9dc15ae6">This mode guarantees that the holder is the only transaction accessing the table in any way.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__a244d4889bb764045806314a8f8e935a4">Acquired by the <strong id="EN-US_TOPIC_0000001510400945__b96457050933715">ALTER TABLE</strong>, <strong id="EN-US_TOPIC_0000001510400945__b99855136833715">DROP TABLE</strong>, <strong id="EN-US_TOPIC_0000001510400945__b85526066533715">TRUNCATE</strong>, <strong id="EN-US_TOPIC_0000001510400945__b41567511633715">REINDEX</strong>, <strong id="EN-US_TOPIC_0000001510400945__b134407122833715">CLUSTER</strong>, and <strong id="EN-US_TOPIC_0000001510400945__b131681013633715">VACUUM FULL</strong> commands.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__ac96c7088bed84158a55d9d75e5a03d55">This is also the default lock mode for <strong id="EN-US_TOPIC_0000001510400945__b5268604133715">LOCK TABLE</strong> statements that do not specify a mode explicitly.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__li1551492814306"><strong id="EN-US_TOPIC_0000001510400945__b1151419288307">UPDATE EXCLUSIVE</strong><p id="EN-US_TOPIC_0000001510400945__p819717519317">The <strong id="EN-US_TOPIC_0000001510400945__b42111011735">UPDATE EXCLUSIVE</strong> lock allows concurrent <strong id="EN-US_TOPIC_0000001510400945__b34473101533">(AUTO) VACUUM</strong> and <strong id="EN-US_TOPIC_0000001510400945__b55337142320">(AUTO) ANALYZE</strong>, but does not allow concurrent <strong id="EN-US_TOPIC_0000001510400945__b814822216311">(AUTO) VACUUM</strong>.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001510400945__note696162913211"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001510400945__ul334818338317"><li id="EN-US_TOPIC_0000001510400945__li63482336312">This parameter is supported only by clusters of version 8.2.1.300 or later.</li><li id="EN-US_TOPIC_0000001510400945__li83481333737">The <strong id="EN-US_TOPIC_0000001510400945__b263544316312">UPDATE EXCLUSIVE</strong> lock is used only in the <strong id="EN-US_TOPIC_0000001510400945__b19492125215310">VACUUM</strong> syntax.</li></ul>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__lde394eca79494876b88a09d7d21231dd"><strong id="EN-US_TOPIC_0000001510400945__a9a490fd36e664143b619f418a66f1168">NOWAIT</strong><p id="EN-US_TOPIC_0000001510400945__a937309b6a169409d94b5ab941ee922c9">Specifies that <strong id="EN-US_TOPIC_0000001510400945__b45320027183935">LOCK TABLE</strong> should not wait for any conflicting locks to be released: if the specified lock(s) cannot be acquired immediately without waiting, the transaction is aborted.</p>
|
|
<p id="EN-US_TOPIC_0000001510400945__a5f7b2b1446d04c8089da5e6c8928931c">If <strong id="EN-US_TOPIC_0000001510400945__b52433432183935">NOWAIT</strong> is not specified, <strong id="EN-US_TOPIC_0000001510400945__b2138848183935">LOCK TABLE</strong> obtains a table-level lock, waiting if necessary for any conflicting locks to be released.</p>
|
|
</li><li id="EN-US_TOPIC_0000001510400945__li123941939505"><strong id="EN-US_TOPIC_0000001510400945__b10450545011">LOCAL COORDINATOR ONLY</strong><p id="EN-US_TOPIC_0000001510400945__p1197720413131">Specifies that LOCK TABLE is executed only on the CN that receives the current session request and is not delivered to other CNs or all DNs. This is used only for metadata operations to improve efficiency.</p>
|
|
<div class="notice" id="EN-US_TOPIC_0000001510400945__note33229469132"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="EN-US_TOPIC_0000001510400945__ul424614161415"><li id="EN-US_TOPIC_0000001510400945__li1024701101417">This parameter is supported by clusters of version 8.2.0.100 or later.</li><li id="EN-US_TOPIC_0000001510400945__li1224710113148">Currently, only the ACCESS SHARE lock mode is supported. If other lock modes are used, an error will be reported.</li></ul>
|
|
</div></div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001510400945__s4521fa51a8ca439a861325ad0633359a"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001510400945__p15611257194818">Obtain a <strong id="EN-US_TOPIC_0000001510400945__b1572719014">SHARE</strong> lock on a primary key table when going to perform inserts into a foreign key table.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510400945__screen1725931554912"><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">START</span><span class="w"> </span><span class="k">TRANSACTION</span><span class="p">;</span>
|
|
|
|
<span class="k">LOCK</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason</span><span class="w"> </span><span class="k">IN</span><span class="w"> </span><span class="k">SHARE</span><span class="w"> </span><span class="k">MODE</span><span class="p">;</span>
|
|
|
|
<span class="k">SELECT</span><span class="w"> </span><span class="n">r_reason_desc</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">r_reason_sk</span><span class="o">=</span><span class="mi">5</span><span class="p">;</span>
|
|
<span class="n">r_reason_desc</span>
|
|
<span class="c1">-----------</span>
|
|
<span class="w"> </span><span class="n">Parts</span><span class="w"> </span><span class="n">missing</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
|
|
<span class="k">COMMIT</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001510400945__p12611573488">Obtain a <strong id="EN-US_TOPIC_0000001510400945__b21391715104217">SHARE ROW EXCLUSIVE</strong> lock on a primary key table when performing a delete operation.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510400945__screen1929603514491"><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">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason_t1</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason</span><span class="p">;</span>
|
|
|
|
<span class="k">START</span><span class="w"> </span><span class="k">TRANSACTION</span><span class="p">;</span>
|
|
|
|
<span class="k">LOCK</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason_t1</span><span class="w"> </span><span class="k">IN</span><span class="w"> </span><span class="k">SHARE</span><span class="w"> </span><span class="k">ROW</span><span class="w"> </span><span class="k">EXCLUSIVE</span><span class="w"> </span><span class="k">MODE</span><span class="p">;</span>
|
|
|
|
<span class="k">DELETE</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason_t1</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">r_reason_desc</span><span class="w"> </span><span class="k">IN</span><span class="p">(</span><span class="k">SELECT</span><span class="w"> </span><span class="n">r_reason_desc</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason_t1</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">r_reason_sk</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">6</span><span class="w"> </span><span class="p">);</span>
|
|
|
|
<span class="k">DELETE</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason_t1</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">r_reason_sk</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">7</span><span class="p">;</span>
|
|
|
|
<span class="k">COMMIT</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001510400945__p11606579489">Delete the <strong id="EN-US_TOPIC_0000001510400945__b95331689233715"><span id="EN-US_TOPIC_0000001510400945__text42799192733715">tpcds.</span>reason_t1</strong> table.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001510400945__screen31661559114911"><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">TABLE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">reason_t1</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001510400945__p1224488712">Add the ACCESS SHARE lock to the table and set the lock scope to the current CN.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001510400945__screen914618361192">BEGIN;
|
|
LOCK TABLE lock_test IN ACCESS SHARE MODE LOCAL COORDINATOR ONLY;
|
|
SELECT pg_get_tabledef('lock_test');
|
|
END;</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0227.html">DML Syntax</a></div>
|
|
</div>
|
|
</div>
|
|
|