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

28 lines
6.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<a name="EN-US_TOPIC_0000001188482204"></a><a name="EN-US_TOPIC_0000001188482204"></a>
<h1 class="topictitle1">SMP Manual Optimization Suggestions</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188482204__a3cfb9e73eb3449a3849b3426bc88c86e">To manually optimize SMP, you need to be familiar with <a href="dws_04_0424.html">Suggestions for SMP Parameter Settings</a>. This section describes how to optimize SMP.</p>
<div class="section" id="EN-US_TOPIC_0000001188482204__sf5d58faee8c9402a8e29eaada1a84b65"><h4 class="sectiontitle">Constraints</h4><p id="EN-US_TOPIC_0000001188482204__a8ff6e416746f411297808e3dab0d49c4">The CPU, memory, I/O, and network bandwidth resources are sufficient. The SMP architecture uses abundant resources to save time. After the plan parallelism is executed, resource consumption increases. When these resources become a bottleneck, SMP may deteriorate, rather than improve performance. In addition, it takes a longer time to generate SMP plans than serial plans. Therefore, in TP services that mainly involve short queries or in case resources are insufficient, you are advised to disable SMP by setting <strong id="EN-US_TOPIC_0000001188482204__b14633203915257">query_dop</strong> to <strong id="EN-US_TOPIC_0000001188482204__b6361194212250">1</strong>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001188482204__s0ebc1372a62f4351b99366aa81505442"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0000001188482204__o38bef8205e6a4ebdbc8d342579496bec"><li id="EN-US_TOPIC_0000001188482204__l832746b6d01c46e89e86d77b43e825e2">Observe the current system load situation. If the resource is sufficient (the resource usage ratio is smaller than 50%), perform step 2. Otherwise, exit this system.</li><li id="EN-US_TOPIC_0000001188482204__l07d708eca14e4efbb41b93676e4e5f02">Set <strong id="EN-US_TOPIC_0000001188482204__en-us_topic_0058968315_b842352706183223">query_dop</strong> to <strong id="EN-US_TOPIC_0000001188482204__en-us_topic_0058968315_b842352706183227">1</strong> (default value). Use <strong id="EN-US_TOPIC_0000001188482204__en-us_topic_0058968315_b84235270694835">explain</strong> to generate an execution plan and check whether the plan can be used in scenarios in <a href="dws_04_0421.html">Application Scenarios and Restrictions</a>. If the plan can be used, go to the next step.</li><li id="EN-US_TOPIC_0000001188482204__li616455562717">Set <strong id="EN-US_TOPIC_0000001188482204__b98091317618">query_dop=</strong><em id="EN-US_TOPIC_0000001188482204__i879001519619">value</em>. The value range of the parallelism degree is [1, <em id="EN-US_TOPIC_0000001188482204__i153394211577">value</em>].</li><li id="EN-US_TOPIC_0000001188482204__li68414552917">Set <strong id="EN-US_TOPIC_0000001188482204__b1919119981">query_dop=</strong><em id="EN-US_TOPIC_0000001188482204__i168793221812">value</em>. The parallelism degree is 1 or <em id="EN-US_TOPIC_0000001188482204__i1231220139910">value</em>.</li><li id="EN-US_TOPIC_0000001188482204__leb68f29ff73849fea97d93002ccde5c1">Before the query statement is executed, set <strong id="EN-US_TOPIC_0000001188482204__b842352706183722">query_dop</strong> to an appropriate value. After the statement is executed, set <strong id="EN-US_TOPIC_0000001188482204__b842352706183732">query_dop</strong> to <strong id="EN-US_TOPIC_0000001188482204__b842352706183742">off</strong>. For example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188482204__sdfd7f8a465f74db1800a456d46c0a7b0"><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></pre></div></td><td class="code"><div><pre><span></span><span class="k">SET</span><span class="w"> </span><span class="n">query_dop</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
<span class="k">SELECT</span><span class="w"> </span><span class="k">COUNT</span><span class="p">(</span><span class="o">*</span><span class="p">)</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">t1</span><span class="w"> </span><span class="k">GROUP</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">a</span><span class="p">;</span>
<span class="p">......</span>
<span class="k">SET</span><span class="w"> </span><span class="n">query_dop</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<div class="note" id="EN-US_TOPIC_0000001188482204__n6caf1640edea4f0aad7d80cdf99fc6f0"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188482204__ude64952f02ff42a9bb19110ca02692f9"><li id="EN-US_TOPIC_0000001188482204__l3855f80ad72d457eadf561cd85f04fd7">If resources are enough, the higher the parallelism degree is, the better the performance improvement effect is.</li><li id="EN-US_TOPIC_0000001188482204__ld43f208342d947ef8374e2d38bced86a">The SMP parallelism degree supports a session level setting and you are advised to enable the SMP before executing the query that meets the requirements. After the execution is complete, disable the SMP. Otherwise, SMP may affect services in peak hours.</li><li id="EN-US_TOPIC_0000001188482204__li165091153143210">SMP adaptation (<strong id="EN-US_TOPIC_0000001188482204__b18199144316011">query_dop</strong> ≤ 0) depends on resource management. If resource management is disabled (<span id="EN-US_TOPIC_0000001188482204__ph423603710204">use_workload_manager</span> is <strong id="EN-US_TOPIC_0000001188482204__b720014312013">off</strong>), plans with parallelism degree of only 1 or 2 are generated.</li></ul>
</div></div>
</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0420.html">Configuring SMP</a></div>
</div>
</div>