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

78 lines
20 KiB
HTML

<a name="EN-US_TOPIC_0000001233430201"></a><a name="EN-US_TOPIC_0000001233430201"></a>
<h1 class="topictitle1">CREATE RESOURCE POOL</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001233430201__s481d5e7513234b5da5afa651779c4c88"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001233430201__abb80066efd654eb4a8f28df85ab6c4a8"><strong id="EN-US_TOPIC_0000001233430201__b8423527069530">CREATE RESOURCE POOL</strong> creates a resource pool and specifies the Cgroup for the resource pool.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430201__s47b068168d224223acc0948471f3a6cf"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001233430201__a7561ac0e19b74338846c05b3f21499cc">As long as the current user has <strong id="EN-US_TOPIC_0000001233430201__b199711936132315">CREATE</strong> permission, it can create a resource pool.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430201__s0f52c8b36b4240238e05e06d9a23563f"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233430201__se66b72dbaf7d45058bae62f75cd43c72"><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">CREATE</span><span class="w"> </span><span class="n">RESOURCE</span><span class="w"> </span><span class="n">POOL</span><span class="w"> </span><span class="n">pool_name</span>
<span class="w"> </span><span class="p">[</span><span class="k">WITH</span><span class="w"> </span><span class="p">(</span><span class="err">{</span><span class="n">MEM_PERCENT</span><span class="o">=</span><span class="n">pct</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">CONTROL_GROUP</span><span class="o">=</span><span class="ss">&quot;group_name&quot;</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">ACTIVE_STATEMENTS</span><span class="o">=</span><span class="n">stmt</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">MAX_DOP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">dop</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">MEMORY_LIMIT</span><span class="o">=</span><span class="s1">'memory_size'</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">io_limits</span><span class="o">=</span><span class="n">io_limits</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">io_priority</span><span class="o">=</span><span class="s1">'io_priority'</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">nodegroup</span><span class="o">=</span><span class="ss">&quot;nodegroupname&quot;</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">is_foreign</span><span class="o">=</span><span class="nb">boolean</span><span class="w"> </span><span class="err">}</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>
<div class="section" id="EN-US_TOPIC_0000001233430201__sa0dea321baa64f0ca14d1f272d44ecee"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001233430201__u40be18fafa8f4f9c8617e0453d7e25da"><li id="EN-US_TOPIC_0000001233430201__l68cb547c8df84296b2bd369b7214dccb"><strong id="EN-US_TOPIC_0000001233430201__a5700896f341c4dee811dce1d51b0ef64">pool_name</strong><p id="EN-US_TOPIC_0000001233430201__a2022419d96f848b7a5d1ac663f490427">Specifies the name of a resource pool.</p>
<p id="EN-US_TOPIC_0000001233430201__a5989c27a141b459ca16c24bc3156c3cc">The name of a resource pool cannot be same as that of an existing resource pool.</p>
<p id="EN-US_TOPIC_0000001233430201__abac1b328e3d7444cb291d0331fad36d6">Value range: a string. It must comply with the naming convention.</p>
</li><li id="EN-US_TOPIC_0000001233430201__lc43cf82afda445038544b8a86e9c658b"><strong id="EN-US_TOPIC_0000001233430201__a39b387294f08436a867b76bc4732e4db">group_name</strong><p id="EN-US_TOPIC_0000001233430201__aabc05b71f918422486cd9d02b286f1f3">Specifies the name of a Cgroup.</p>
<div class="note" id="EN-US_TOPIC_0000001233430201__nc534b7df3baa42619c74b05383873caf"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001233430201__ul979122603318"><li id="EN-US_TOPIC_0000001233430201__li1886010358333">You can use either double quotation marks ("") or single quotation mark ('') in the syntax when setting the name of a Cgroup.</li><li id="EN-US_TOPIC_0000001233430201__ld6a8845d2ff9481889ef631d00d35205">The value of <strong id="EN-US_TOPIC_0000001233430201__b1296125013195">group_name</strong> is case-sensitive.</li><li id="EN-US_TOPIC_0000001233430201__l98539f45240a4ff5b7b80567bb8a22fd">If <strong id="EN-US_TOPIC_0000001233430201__b84235270684931">group_name</strong> is not specified, the string "Medium" will be used by default in the syntax, indicating the <strong id="EN-US_TOPIC_0000001233430201__b1433114217301">Medium</strong> Timeshare Cgroup under DefaultClass.</li><li id="EN-US_TOPIC_0000001233430201__lcdd8bdcbf88a40128b31f8d265e4c1a2">If an administrator specifies a Workload Cgroup under Class, for example, <strong id="EN-US_TOPIC_0000001233430201__b65619398411">control_group</strong> set to <strong id="EN-US_TOPIC_0000001233430201__b195711391244">class1:workload1</strong>, the resource pool will be associated with the <strong id="EN-US_TOPIC_0000001233430201__b35743915411">workload1</strong> Cgroup under <strong id="EN-US_TOPIC_0000001233430201__b10585392416">class1</strong>. The level of Workload can also be specified. For example, <strong id="EN-US_TOPIC_0000001233430201__b940111411169">control_group</strong> is set to <strong id="EN-US_TOPIC_0000001233430201__b840164111619">class1:workload1:1</strong>.</li><li id="EN-US_TOPIC_0000001233430201__l33642d68e4d04bb4a1dcd9948cd8a4fa">If a database user specifies the Timeshare string (<strong id="EN-US_TOPIC_0000001233430201__b649115255515">Rush</strong>, <strong id="EN-US_TOPIC_0000001233430201__b1349313256511">High</strong>, <strong id="EN-US_TOPIC_0000001233430201__b1649417251054">Medium</strong>, or <strong id="EN-US_TOPIC_0000001233430201__b24953257516">Low</strong>) in the syntax, for example, if <strong id="EN-US_TOPIC_0000001233430201__b154968258513">control_group</strong> is set to <strong id="EN-US_TOPIC_0000001233430201__b74976251159">High</strong>, the resource pool will be associated with the <strong id="EN-US_TOPIC_0000001233430201__b74981225256">High</strong> Timeshare Cgroup under <strong id="EN-US_TOPIC_0000001233430201__b174999252520">DefaultClass</strong>.</li><li id="EN-US_TOPIC_0000001233430201__li780317301337">In multi-tenant scenarios, the Cgroup associated with a group resource pool is a Class Cgroup, and that associated with a service resource pool is a Workload Cgroup. Additionally, switching Cgroups between different resource pools is not allowed.</li></ul>
</div></div>
<p id="EN-US_TOPIC_0000001233430201__a545578a1bde6403488cc36b98616a763">Value range: a string. It must comply with the rule in the description, specifying an existing Cgroup.</p>
</li><li id="EN-US_TOPIC_0000001233430201__lb1fb689ae3a54cfbbcc1697a5f1ce653"><strong id="EN-US_TOPIC_0000001233430201__a3dbe63086cb341d2b39261b81a45ce57">stmt</strong><p id="EN-US_TOPIC_0000001233430201__a238e1c5e3e274f47a7cfa063de4f9b43">Specifies the maximum number of statements that can be concurrently executed in a resource pool.</p>
<p id="EN-US_TOPIC_0000001233430201__ad4f096c8ce324dc6bfd6bd7a74b88ac9">Value range: Numeric data ranging from <strong id="EN-US_TOPIC_0000001233430201__b8423527061107">-1</strong> to <strong id="EN-US_TOPIC_0000001233430201__b84235270611014">INT_MAX</strong>.</p>
</li><li id="EN-US_TOPIC_0000001233430201__lbdfb48d627384760a61630278da2238a"><strong id="EN-US_TOPIC_0000001233430201__a1edae48705a0452ab3cda40b52d708d8">dop</strong><p id="EN-US_TOPIC_0000001233430201__a855815071ce9482a9b571eaa0b62e55d">Specifies the maximum number of simple SQL statements that can be concurrently executed in a resource pool.</p>
<p id="EN-US_TOPIC_0000001233430201__a6a5a17367c924d888d4f1618279f151f">Value range: Numeric data ranging from <strong id="EN-US_TOPIC_0000001233430201__en-us_topic_0085032251_b84235270611029">1</strong> to <strong id="EN-US_TOPIC_0000001233430201__en-us_topic_0085032251_b84235270611034">INT_MAX</strong>.</p>
</li><li id="EN-US_TOPIC_0000001233430201__l7aa5973388d44dd3b56f587ec8e34e3f"><strong id="EN-US_TOPIC_0000001233430201__a88c12335ff314953a1136b4b3a03b7df">memory_size</strong><p id="EN-US_TOPIC_0000001233430201__a08a55a6d60ff41f7bfcee566e874f947">Specifies the maximum storage for a resource pool.</p>
<p id="EN-US_TOPIC_0000001233430201__a2aec4e1349fb4b90a4f56fdcffadc00f">Value range: a string, from <strong id="EN-US_TOPIC_0000001233430201__en-us_topic_0085031664_en-us_topic_0058966010_b84235270619652">1KB</strong> to <strong id="EN-US_TOPIC_0000001233430201__en-us_topic_0085031664_en-us_topic_0058966010_b84235270619655">2047GB</strong>.</p>
</li><li id="EN-US_TOPIC_0000001233430201__l46d16bd1bc3d4f5095753c85d4c68c74"><strong id="EN-US_TOPIC_0000001233430201__aee4b20cb1cb84ac0933aa4ae1954a9a8">mem_percent</strong><p id="EN-US_TOPIC_0000001233430201__a71f24ac774f341839dcba0c4d0d27b25">Specifies the proportion of available resource pool memory to the total memory or group user memory.</p>
<p id="EN-US_TOPIC_0000001233430201__ad947ae4191fb43c9a97de2456ee5afcb">In multi-tenant scenarios, <strong id="EN-US_TOPIC_0000001233430201__b14824548119505">mem_percent</strong> of group users or service users ranges from <strong id="EN-US_TOPIC_0000001233430201__b84235270695053">1</strong> to <strong id="EN-US_TOPIC_0000001233430201__b84235270695058">100</strong>. The default value is <strong id="EN-US_TOPIC_0000001233430201__b8423527069514">20</strong>.</p>
<p id="EN-US_TOPIC_0000001233430201__ac22ebc9dae164edc8fb75dcbaa9584bd">In common scenarios, <strong id="EN-US_TOPIC_0000001233430201__b7981174117529">mem_percent</strong> of common users ranges from <strong id="EN-US_TOPIC_0000001233430201__b17981204110527">0</strong> to <strong id="EN-US_TOPIC_0000001233430201__b79811841115212">100</strong>. The default value is <strong id="EN-US_TOPIC_0000001233430201__b3981184115527">0</strong>.</p>
<div class="note" id="EN-US_TOPIC_0000001233430201__note82872047173219"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001233430201__p152876474329">When both of <strong id="EN-US_TOPIC_0000001233430201__b842352706104221">mem_percent</strong> and <strong id="EN-US_TOPIC_0000001233430201__b842352706104225">memory_limit</strong> are specified, only <strong id="EN-US_TOPIC_0000001233430201__b842352706104248">mem_percent</strong> takes effect.</p>
</div></div>
</li><li id="EN-US_TOPIC_0000001233430201__li45028228402"><strong id="EN-US_TOPIC_0000001233430201__b1097215485411">io_limits</strong><p id="EN-US_TOPIC_0000001233430201__p79461854124210">This parameter has been discarded in 8.1.2 and is reserved for compatibility with earlier versions.</p>
</li><li id="EN-US_TOPIC_0000001233430201__li128883004311"><strong id="EN-US_TOPIC_0000001233430201__b72702043134311">io_priority</strong><p id="EN-US_TOPIC_0000001233430201__p7308859183115">This parameter has been discarded in 8.1.2 and is reserved for compatibility with earlier versions.</p>
</li><li id="EN-US_TOPIC_0000001233430201__li17474132072010"><strong id="EN-US_TOPIC_0000001233430201__b783017447339">nodegroup</strong><p id="EN-US_TOPIC_0000001233430201__p22612112213">Specifies the name of a logical cluster where the resource pool is. The logical cluster must already exist.</p>
<p id="EN-US_TOPIC_0000001233430201__p31161811220">If the logical cluster name contains uppercase letters or special characters or begins with a digit, enclose the name with double quotation marks in SQL statements.</p>
</li><li id="EN-US_TOPIC_0000001233430201__li7376152614288"><strong id="EN-US_TOPIC_0000001233430201__b723983822815">is_foreign</strong><p id="EN-US_TOPIC_0000001233430201__p16920145014287">In logical cluster mode, the current resource pool is used to control the resources of common users who are not associated with the logical cluster specified by <strong id="EN-US_TOPIC_0000001233430201__b9314191314178">nodegroup</strong>.</p>
<div class="note" id="EN-US_TOPIC_0000001233430201__naa7c94df564c4e998000ec052b02221d"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001233430201__ul12538195564414"><li id="EN-US_TOPIC_0000001233430201__li1538155518447"><strong id="EN-US_TOPIC_0000001233430201__b8495133618179">nodegroup</strong> must specify an existing logical cluster, and cannot be <strong id="EN-US_TOPIC_0000001233430201__b1962713872019">elastic_group</strong> or the default Node Group (<strong id="EN-US_TOPIC_0000001233430201__b06271184207">group_version1</strong>), which is generated during cluster installation.</li><li id="EN-US_TOPIC_0000001233430201__li6538655184412">If <strong id="EN-US_TOPIC_0000001233430201__b443695212174">is_foreign</strong> is set to <strong id="EN-US_TOPIC_0000001233430201__b141951025181">true</strong>, the resource pool cannot be associated with users. That is, <strong id="EN-US_TOPIC_0000001233430201__b322412717189">CREATE USER...</strong> <strong id="EN-US_TOPIC_0000001233430201__b13714331101815">RESOURCE POOL</strong> cannot be used to configure resource pools for users. The resource pool automatically checks whether the users are associated with its logical cluster. If they are not, they will be controlled by the resource pool when performing operations on DNs in the logical cluster.</li></ul>
</div></div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430201__sf1feb5f34bb34a7bbd74b2463b563ac8"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001233430201__a3fdbd6dd84aa49a79a75ced240567a7c">This example assumes that Cgroups have been created by users in advance. </p>
<p id="EN-US_TOPIC_0000001233430201__p464112713123">Create a default resource pool, and associate it with the <strong id="EN-US_TOPIC_0000001233430201__b1621452113418">Medium</strong> Timeshare Cgroup under Workload under <strong id="EN-US_TOPIC_0000001233430201__b133145273415">DefaultClass</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233430201__screen15525337131418"><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">CREATE</span><span class="w"> </span><span class="n">RESOURCE</span><span class="w"> </span><span class="n">POOL</span><span class="w"> </span><span class="n">pool1</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001233430201__p3641172720121">Create a resource pool, and associate it with the <strong id="EN-US_TOPIC_0000001233430201__b12409455133411">High</strong> Timeshare Cgroup under Workload under <strong id="EN-US_TOPIC_0000001233430201__b840905518345">DefaultClass</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233430201__screen164532431146"><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">CREATE</span><span class="w"> </span><span class="n">RESOURCE</span><span class="w"> </span><span class="n">POOL</span><span class="w"> </span><span class="n">pool2</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="p">(</span><span class="n">CONTROL_GROUP</span><span class="o">=</span><span class="ss">&quot;High&quot;</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001233430201__p166409271124">Create a resource pool, and associate it with the <strong id="EN-US_TOPIC_0000001233430201__b2815817344">Low</strong> Timeshare Cgroup under Workload under <strong id="EN-US_TOPIC_0000001233430201__b6865883413">class1</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233430201__screen1790618501142"><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">CREATE</span><span class="w"> </span><span class="n">RESOURCE</span><span class="w"> </span><span class="n">POOL</span><span class="w"> </span><span class="n">pool3</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="p">(</span><span class="n">CONTROL_GROUP</span><span class="o">=</span><span class="ss">&quot;class1:Low&quot;</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001233430201__p564017274121">Create a resource pool, and associate it with the <strong id="EN-US_TOPIC_0000001233430201__b32243234333533">wg1</strong> Workload Cgroup under <strong id="EN-US_TOPIC_0000001233430201__b41583596533533">class1</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233430201__screen16142957151410"><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">CREATE</span><span class="w"> </span><span class="n">RESOURCE</span><span class="w"> </span><span class="n">POOL</span><span class="w"> </span><span class="n">pool4</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="p">(</span><span class="n">CONTROL_GROUP</span><span class="o">=</span><span class="ss">&quot;class1:wg1&quot;</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001233430201__p464042717129">Create a resource pool, and associate it with the <strong id="EN-US_TOPIC_0000001233430201__b193506801033533">wg2</strong> Workload Cgroup under <strong id="EN-US_TOPIC_0000001233430201__b134087236733533">class1</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233430201__screen565317419158"><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">CREATE</span><span class="w"> </span><span class="n">RESOURCE</span><span class="w"> </span><span class="n">POOL</span><span class="w"> </span><span class="n">pool5</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="p">(</span><span class="n">CONTROL_GROUP</span><span class="o">=</span><span class="ss">&quot;class1:wg2:3&quot;</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001233430201__sa345f6f5c62847a2b58ef7607308b25b"><h4 class="sectiontitle">Helpful Links</h4><p id="EN-US_TOPIC_0000001233430201__ae566179eb07c4146b25fabbf0804c7ce"><a href="dws_06_0133.html">ALTER RESOURCE POOL</a>, <a href="dws_06_0202.html">DROP RESOURCE POOL</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>