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>
87 lines
14 KiB
HTML
87 lines
14 KiB
HTML
<a name="EN-US_TOPIC_0000001233563311"></a><a name="EN-US_TOPIC_0000001233563311"></a>
|
|
|
|
<h1 class="topictitle1">Configuring GUC Parameters</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001233563311__p176257192113">To ensure the optimal performance of <span id="EN-US_TOPIC_0000001233563311__text9651125819014">GaussDB(DWS)</span>, you can adjust the GUC parameters in the database.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563311__section158288338503"><h4 class="sectiontitle">Parameter Types and Values</h4><ul id="EN-US_TOPIC_0000001233563311__ul13828733105010"><li id="EN-US_TOPIC_0000001233563311__li3327545181919">The GUC parameters of <span id="EN-US_TOPIC_0000001233563311__text02891447118">GaussDB(DWS)</span> are classified into the following types:<ul id="EN-US_TOPIC_0000001233563311__ul10221191262110"><li id="EN-US_TOPIC_0000001233563311__li95531325112115">SUSET: database administrator parameters. This type of parameters take effect immediately after they are set. You do not need to restart the cluster. If a parameter of this type is set in the current session, the parameter takes effect only in the current session.</li><li id="EN-US_TOPIC_0000001233563311__li29111286216">USERSET: common user parameters. This type of parameters take effect immediately after they are set. You do not need to restart the cluster. If a parameter of this type is set in the current session, the parameter takes effect only in the current session.</li><li id="EN-US_TOPIC_0000001233563311__li481891519213">POSTMASTER: database server parameters. This type of parameters take effect only after the cluster is restarted. After you modify a parameter of this type, the system displays a message indicating that the cluster is to be restarted. You are advised to manually restart the cluster during off-peak hours for the setting to take effect.</li><li id="EN-US_TOPIC_0000001233563311__li8181619192112">SIGHUP: global database parameters. This type of parameters take effect globally and cannot take effect for single sessions.</li><li id="EN-US_TOPIC_0000001233563311__li122561822172117">BACKEND: global database parameters. This type of parameters take effect globally and cannot take effect for single sessions.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001233563311__li13254154702411">All parameter names are case insensitive. A parameter value can be an integer, floating point number, string, Boolean value, or enumerated value.<ul id="EN-US_TOPIC_0000001233563311__ul3830433165014"><li id="EN-US_TOPIC_0000001233563311__li5830123375020">The Boolean values can be <strong id="EN-US_TOPIC_0000001233563311__b146153110111">on</strong>/<strong id="EN-US_TOPIC_0000001233563311__b154681931113">off</strong>, <strong id="EN-US_TOPIC_0000001233563311__b346815311919">true</strong>/<strong id="EN-US_TOPIC_0000001233563311__b44681031718">false</strong>, <strong id="EN-US_TOPIC_0000001233563311__b13469203113112">yes</strong>/<strong id="EN-US_TOPIC_0000001233563311__b19469531012">no</strong>, or <strong id="EN-US_TOPIC_0000001233563311__b74690312114">1</strong>/<strong id="EN-US_TOPIC_0000001233563311__b1846915314113">0</strong>, and are case-insensitive.</li><li id="EN-US_TOPIC_0000001233563311__li1830183355018">The enumerated value range is specified in the <strong id="EN-US_TOPIC_0000001233563311__b199294331219">enumvals</strong> column of the system catalog <strong id="EN-US_TOPIC_0000001233563311__b59298332117">pg_settings</strong>.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001233563311__li98306339504">For parameters using units, specify their units during the setting, or default units are used.<ul id="EN-US_TOPIC_0000001233563311__ul883173310503"><li id="EN-US_TOPIC_0000001233563311__li5831433165018">The default units are specified in the <strong id="EN-US_TOPIC_0000001233563311__b186951535311">unit</strong> column of <strong id="EN-US_TOPIC_0000001233563311__b116963358120">pg_settings</strong>.</li><li id="EN-US_TOPIC_0000001233563311__li5831173320504">The unit of memory can be KB, MB, or GB.</li><li id="EN-US_TOPIC_0000001233563311__li158311833195016">The unit of time can be ms, s, min, h, or d.</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563311__s8adb68393b48467a948956afaaaf8589"><a name="EN-US_TOPIC_0000001233563311__s8adb68393b48467a948956afaaaf8589"></a><a name="s8adb68393b48467a948956afaaaf8589"></a><h4 class="sectiontitle">Setting GUC Parameters</h4><p id="EN-US_TOPIC_0000001233563311__p47751156175112">You can configure GUC parameters in the following ways:</p>
|
|
<ul id="EN-US_TOPIC_0000001233563311__ul622174311816"><li id="EN-US_TOPIC_0000001233563311__li16763132452120">Method 1: After a cluster is created, you can log in to the GaussDB(DWS) management console and modify the database parameters of the cluster.<p id="EN-US_TOPIC_0000001233563311__p735919720223"><a name="EN-US_TOPIC_0000001233563311__li16763132452120"></a><a name="li16763132452120"></a>For details, see "Modifying Database Parameters" in the <em id="EN-US_TOPIC_0000001233563311__i1844814853818">Data Warehouse Service User Guide</em>.</p>
|
|
</li><li id="EN-US_TOPIC_0000001233563311__li1922134319184">Method 2: Connect to a cluster and run SQL commands to configure the parameters of the SUSET or USERSET type.<p id="EN-US_TOPIC_0000001233563311__p2781256516"><a name="EN-US_TOPIC_0000001233563311__li1922134319184"></a><a name="li1922134319184"></a>Set parameters at database, user, or session levels.</p>
|
|
<ul id="EN-US_TOPIC_0000001233563311__ul187882519519"><li id="EN-US_TOPIC_0000001233563311__li10781125105111">Set a database-level parameter.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563311__screen0781025185111"><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">ALTER</span><span class="w"> </span><span class="k">DATABASE</span><span class="w"> </span><span class="n">dbname</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="n">paraname</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">value</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001233563311__p1379192575114">The setting takes effect in the next session.</p>
|
|
</li><li id="EN-US_TOPIC_0000001233563311__li1879825125117">Set a user-level parameter.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563311__screen18792025135115"><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">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">username</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="n">paraname</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">value</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001233563311__p13792255516">The setting takes effect in the next session.</p>
|
|
</li><li id="EN-US_TOPIC_0000001233563311__li19791425145115">Set a session-level parameter.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563311__screen187922525113"><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">SET</span><span class="w"> </span><span class="n">paraname</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">value</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001233563311__p18016257513">Parameter value in the current session is changed. After you exit the session, the setting becomes invalid.</p>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563311__s0d9f4423bd77437fbddda52e62f013e4"><h4 class="sectiontitle">Procedure</h4><p id="EN-US_TOPIC_0000001233563311__afeb2fd6d86b541d69f4b47b7f01a58ee">The following example shows how to set <strong id="EN-US_TOPIC_0000001233563311__en-us_topic_0058967671_b842352706145037_5">explain_perf_mode</strong>.</p>
|
|
<ol id="EN-US_TOPIC_0000001233563311__ocbb8f3643e1b4bfeac9d5423bf7b437b"><li id="EN-US_TOPIC_0000001233563311__lc6095db01378492bb9a803c59222f5d8"><span>View the value of <strong id="EN-US_TOPIC_0000001233563311__b407045863">explain_perf_mode</strong>.</span><p><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563311__s41da16ce396d4b9d81914497df41357d"><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></pre></div></td><td class="code"><div><pre><span></span><span class="k">SHOW</span><span class="w"> </span><span class="n">explain_perf_mode</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">explain_perf_mode</span><span class="w"> </span>
|
|
<span class="c1">-------------------</span>
|
|
<span class="w"> </span><span class="n">normal</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</p></li><li id="EN-US_TOPIC_0000001233563311__l96352d5b81d1467bb8681b8559bb55c0"><span>Set <strong id="EN-US_TOPIC_0000001233563311__b842352706145537">explain_perf_mode</strong>.</span><p><p id="EN-US_TOPIC_0000001233563311__a59079be0eaf44a31a276de788d2ed67e">Perform one of the following operations:</p>
|
|
<ul id="EN-US_TOPIC_0000001233563311__u003f12642cfa4cbe823ea3b4296cc622"><li id="EN-US_TOPIC_0000001233563311__lf96a9767e3e346ce89dfd8abf7b73217">Set a database-level parameter.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563311__sf2f27851bcb946c68ffcbc18a3887e84"><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">ALTER</span><span class="w"> </span><span class="k">DATABASE</span><span class="w"> </span><span class="n">gaussdb</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="n">explain_perf_mode</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">pretty</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001233563311__p16505927184014">If the following information is displayed, the setting has been modified.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001233563311__screen2066103544011">ALTER DATABASE</pre>
|
|
<p id="EN-US_TOPIC_0000001233563311__ac0919336c45245bd8f7734c31ac907f2">The setting takes effect in the next session.</p>
|
|
</li><li id="EN-US_TOPIC_0000001233563311__la416f43b3da645c388b84380954cff1e">Set a user-level parameter.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563311__se728ffc690cd4352996e7ce589f9d97b"><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">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">dbadmin</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="n">explain_perf_mode</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">pretty</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001233563311__p6814011010">If the following information is displayed, the setting has been modified.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001233563311__screen11177526443">ALTER USER</pre>
|
|
<p id="EN-US_TOPIC_0000001233563311__ac4e7d4b148314cad9e95953034def1ed">The setting takes effect in the next session.</p>
|
|
</li><li id="EN-US_TOPIC_0000001233563311__l155cb21f69d948f2b390b5e3fe5f0b1c">Set a session-level parameter.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563311__s6fccb66479584e79b6c5ac6ebca55bb9"><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">SET</span><span class="w"> </span><span class="n">explain_perf_mode</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">pretty</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001233563311__p1965311710362">If the following information is displayed, the setting has been modified.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001233563311__screen128161828183619">SET</pre>
|
|
</li></ul>
|
|
</p></li><li id="EN-US_TOPIC_0000001233563311__ld743fd6d5b6d4068a20d309103e9a9b6"><span>Check whether the parameter is correctly set.</span><p><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563311__s7ce0f2f332d24df38b25857012b19b6c"><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></pre></div></td><td class="code"><div><pre><span></span><span class="k">SHOW</span><span class="w"> </span><span class="n">explain_perf_mode</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">explain_perf_mode</span>
|
|
<span class="c1">--------------</span>
|
|
<span class="w"> </span><span class="n">pretty</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0883.html">GUC Parameters</a></div>
|
|
</div>
|
|
</div>
|
|
|