forked from docs/doc-exports
Reviewed-by: Wagner, Fabian <fabian.wagner@t-systems.com> Co-authored-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-committed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
67 lines
9.5 KiB
HTML
67 lines
9.5 KiB
HTML
<a name="ddm_12_0010"></a><a name="ddm_12_0010"></a>
|
|
|
|
<h1 class="topictitle1">Overview</h1>
|
|
<div id="body0000001217579793"><p id="ddm_12_0010__en-us_topic_0077295697_p359411255537">Global sequences are mainly database-based global sequences.</p>
|
|
<div class="note" id="ddm_12_0010__n405d659471ff4280bd5e0e5bed63d52d"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="ddm_12_0010__ul353195015515"><li id="ddm_12_0010__li6502195421113">The start auto-increment SN can be modified.</li><li id="ddm_12_0010__li2063813117429">Global sequence provides sequence numbers that are globally unique but may not increase continuously.</li></ul>
|
|
</div></div>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ddm_12_0010__td4591403fc2c48f2a46ca9438eed957f" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Table types supported by global sequence</caption><thead align="left"><tr id="ddm_12_0010__r2cdab8c14c5e469089d7ec892a4e5b5b"><th align="left" class="cellrowborder" valign="top" width="25.24252425242524%" id="mcps1.3.3.2.5.1.1"><p id="ddm_12_0010__a44abc09caa254468b23ecf36d97b106e"><strong id="ddm_12_0010__b138168196555">Table Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="24.76247624762476%" id="mcps1.3.3.2.5.1.2"><p id="ddm_12_0010__p156418542297"><strong id="ddm_12_0010__b34122022125510">Sharded</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="24.902490249024904%" id="mcps1.3.3.2.5.1.3"><p id="ddm_12_0010__p20427144612919">Broadcast</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25.092509250925094%" id="mcps1.3.3.2.5.1.4"><p id="ddm_12_0010__a9906b505f4e7480f8b9ab97a14dc59bd">Unsharded</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ddm_12_0010__row188104913299"><td class="cellrowborder" valign="top" width="25.24252425242524%" headers="mcps1.3.3.2.5.1.1 "><p id="ddm_12_0010__p1788496293">DB-based</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.76247624762476%" headers="mcps1.3.3.2.5.1.2 "><p id="ddm_12_0010__p1564195410295">Supported</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.902490249024904%" headers="mcps1.3.3.2.5.1.3 "><p id="ddm_12_0010__p48194922912">Supported</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25.092509250925094%" headers="mcps1.3.3.2.5.1.4 "><p id="ddm_12_0010__p1291649102915">Not supported</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="ddm_12_0010__section13417501561"><h4 class="sectiontitle">Creating an Auto-Increment Sequence</h4><ol id="ddm_12_0010__ol43418505611"><li id="ddm_12_0010__li183413501967"><span>Log in to the required DDM instance using a client.</span></li><li id="ddm_12_0010__li2345501261"><span>Open the required schema.</span></li><li id="ddm_12_0010__li1234050069"><span>Run the following command to create an auto-increment sequence:</span><p><p id="ddm_12_0010__p334155016615"><strong id="ddm_12_0010__b163465017612">create sequence</strong> <seq_name>;</p>
|
|
<div class="note" id="ddm_12_0010__note334150065"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="ddm_12_0010__ul234550661"><li id="ddm_12_0010__li1341501460"><em id="ddm_12_0010__i1616910534817"><seq_name></em> indicates the sequence name.</li><li id="ddm_12_0010__li10979720145419">The auto-increment key should be a BIGINT value. To avoid duplicate values, do not use TINYINT, SMALLINT, MEDIUMINT, INTEGER, or INT as the auto-increment key.</li><li id="ddm_12_0010__li0952172415344">Run <span class="uicontrol" id="ddm_12_0010__uicontrol852120815357"><b>show sequences</b></span> to view the usage of the auto-increment sequence. If the usage reaches 100%, do not insert data anymore.</li></ul>
|
|
</div></div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="ddm_12_0010__section142361236192218"><h4 class="sectiontitle">Dropping an Auto-Increment Sequence</h4><ol id="ddm_12_0010__ol16771339132211"><li id="ddm_12_0010__li97711139172210"><span>Log in to the required DDM instance using a client.</span></li><li id="ddm_12_0010__li277113942215"><span>Open the required schema.</span></li><li id="ddm_12_0010__li5772103922216"><span>Run <span class="uicontrol" id="ddm_12_0010__uicontrol57851411398"><b>show sequences</b></span> to view all global sequences.</span></li><li id="ddm_12_0010__li1037139182416"><span>Run the following command to drop an auto-increment sequence:</span><p><p id="ddm_12_0010__p39887362242"><strong id="ddm_12_0010__b59881236152417">drop sequence</strong> <seq_name> ;</p>
|
|
<p id="ddm_12_0010__p16810101162517"><strong id="ddm_12_0010__b1779832014256">drop sequence</strong> <em id="ddm_12_0010__i12560111223416">DB.</em><seq_name>;</p>
|
|
<div class="note" id="ddm_12_0010__n76f3bfb0d6d84644b81090485adf669e"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="ddm_12_0010__ul91609424267"><li id="ddm_12_0010__li17160134222618">The sequence name is case-insensitive.</li><li id="ddm_12_0010__li15160104215269">If an auto-increment sequence is inherent to a table, the sequence cannot be deleted.</li></ul>
|
|
</div></div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="ddm_12_0010__section1285114112612"><h4 class="sectiontitle">Modifying the Start Value of an Auto-Increment Sequence</h4><ol id="ddm_12_0010__ol09921458614"><li id="ddm_12_0010__li179924454613"><span>Log in to the required DDM instance using a client.</span></li><li id="ddm_12_0010__li7992134516614"><span>Open the required schema.</span></li><li id="ddm_12_0010__li1599214452613"><span>Run <span class="uicontrol" id="ddm_12_0010__uicontrol79105371297"><b>show sequences</b></span> to view all global sequences.</span></li><li id="ddm_12_0010__li999313451564"><span>Run the command to change the start value:</span><p><p id="ddm_12_0010__p7993945761"><strong id="ddm_12_0010__b799314515615">alter sequence</strong> <seq_name> <strong id="ddm_12_0010__b16993245665">START WITH</strong> <start_value><em id="ddm_12_0010__i85341315103515">;</em></p>
|
|
<div class="note" id="ddm_12_0010__note129931454616"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="ddm_12_0010__ul399324518619"><li id="ddm_12_0010__li59931645867"><em id="ddm_12_0010__i19203194910912"><seq_name></em> indicates the sequence name.</li><li id="ddm_12_0010__li1699316452618"><em id="ddm_12_0010__i64028511399"><start_value></em> indicates the start value of the target sequence.</li></ul>
|
|
</div></div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="ddm_12_0010__section13745195613155"><h4 class="sectiontitle">Querying an Auto-Increment Sequence</h4><ol id="ddm_12_0010__ol556262411618"><li id="ddm_12_0010__li2056213241469"><span>Log in to the required DDM instance using a client.</span></li><li id="ddm_12_0010__li65623241460"><span>Open the required schema.</span></li><li id="ddm_12_0010__li9563122413612"><span>Run <span class="uicontrol" id="ddm_12_0010__uicontrol442015914919"><b>show sequences</b></span> to view all global sequences.</span><p><p id="ddm_12_0010__p085119381612"><strong id="ddm_12_0010__b187475431869">show sequences</strong>;</p>
|
|
<p id="ddm_12_0010__p12546143353811"><span><img id="ddm_12_0010__image16942164010316" src="en-us_image_0000001685307306.jpg"></span></p>
|
|
</p></li></ol>
|
|
<p id="ddm_12_0010__p1064113551153"></p>
|
|
</div>
|
|
<div class="section" id="ddm_12_0010__section19746135618153"><h4 class="sectiontitle">Modifying the Auto-Increment Cache Value</h4><div class="notice" id="ddm_12_0010__note15717795221"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="ddm_12_0010__p571809152218">This feature is only available in kernel 3.0.3 and later versions.</p>
|
|
</div></div>
|
|
<ol id="ddm_12_0010__ol894583311611"><li id="ddm_12_0010__li1131716533614"><span>Log in to the required DDM instance using a client.</span></li><li id="ddm_12_0010__li203171653362"><span>Open the required schema.</span></li><li id="ddm_12_0010__li327013309710"><span>Run command <span class="uicontrol" id="ddm_12_0010__uicontrol21383495105"><b>alter sequence test cache 5000</b></span> to modify the global sequence cache value of table <strong id="ddm_12_0010__b614134920102">test</strong>.</span></li><li id="ddm_12_0010__li118921835790"><span>Run command <span class="uicontrol" id="ddm_12_0010__uicontrol1286163171114"><b>show sequences</b></span> to view the cache value (<strong id="ddm_12_0010__b16871437118">INCREMENT</strong> value) of table <strong id="ddm_12_0010__b2884361116">test</strong>.</span></li></ol>
|
|
</div>
|
|
<div class="section" id="ddm_12_0010__section17746145641518"><h4 class="sectiontitle">Updating Auto-Increment Sequences of All Tables</h4><div class="notice" id="ddm_12_0010__note6788155011247"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="ddm_12_0010__p1578835052417">This feature is available only in kernel 3.0.4.1 or later.</p>
|
|
</div></div>
|
|
<ol id="ddm_12_0010__ol68692010112317"><li id="ddm_12_0010__li1486916105234"><span>Log in to the required DDM instance using a client.</span></li><li id="ddm_12_0010__li20870111015234"><span>Run command <span class="uicontrol" id="ddm_12_0010__uicontrol919582981115"><b>fresh all sequence start value</b></span> to change sequences of all schemas.</span></li></ol>
|
|
</div>
|
|
<p id="ddm_12_0010__p8060118"></p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="ddm_03_0030.html">Global Sequence</a></div>
|
|
</div>
|
|
</div>
|
|
|