forked from docs/doc-exports
Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: wangdengke2 <wangdengke2@huawei.com> Co-committed-by: wangdengke2 <wangdengke2@huawei.com>
194 lines
18 KiB
HTML
194 lines
18 KiB
HTML
<a name="rds_20_0001"></a><a name="rds_20_0001"></a>
|
|
|
|
<h1 class="topictitle1">Adding a SQL Throttling Rule for a Database</h1>
|
|
<div id="body0000002376358590"><div class="section" id="rds_20_0001__en-us_topic_0000001789916316_section4850156117316"><h4 class="sectiontitle">Function</h4><p id="rds_20_0001__en-us_topic_0000001789916316_p52780252141331">This API is used to add a SQL throttling rule for a database.</p>
|
|
<ul id="rds_20_0001__ul10163594121"><li id="rds_20_0001__en-us_topic_0240111818_li836513175363">Before calling an API, you need to understand the API in <a href="rds_03_0001.html">Authentication</a>.</li><li id="rds_20_0001__en-us_topic_0240111818_li1991981933613">Before calling this API, obtain the required <a href="https://docs.otc.t-systems.com/en-us/endpoint/index.html" target="_blank" rel="noopener noreferrer">region and endpoint</a>.</li></ul>
|
|
</div>
|
|
<div class="section" id="rds_20_0001__section7996151810239"><h4 class="sectiontitle">Constraints</h4><ul id="rds_20_0001__ul137143121911"><li id="rds_20_0001__li1824218129919">SQL statements executed by built-in users (<strong id="rds_20_0001__b1887903812195">rdsAdmin</strong>, <strong id="rds_20_0001__b1968444111194">rdsMetric</strong>, <strong id="rds_20_0001__b1760974413192">rdsRepl</strong>, and <strong id="rds_20_0001__b167691547161919">rdsBackup</strong>) are not affected by SQL throttling rules.</li></ul>
|
|
<ul id="rds_20_0001__ul1755817508592"><li id="rds_20_0001__li555819502596">To use SQL throttling, the self-developed extension rds_pg_sql_ccl must be installed. For details, see <a href="rds_11_0012.html">Creating an Extension</a>.</li><li id="rds_20_0001__li1957920195190">Before enabling SQL throttling, you must set the RDS for PostgreSQL kernel parameter <strong id="rds_20_0001__b14152165285213">rds_pg_sql_ccl.enable_ccl</strong> to <strong id="rds_20_0001__b542885510524">ON</strong>. For details, see <a href="rds_09_0303.html">Modifying a Parameter Template</a>.<p id="rds_20_0001__en-us_topic_0000001829962645_p03111646102918">By default, the kernel parameter <strong id="rds_20_0001__b3470104025318">rds_pg_sql_ccl.enable_ccl</strong> is set to <strong id="rds_20_0001__b2986104205310">OFF</strong>.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="rds_20_0001__en-us_topic_0000001789916316_section28961517113719"><h4 class="sectiontitle">URI</h4><ul id="rds_20_0001__en-us_topic_0000001789916316_ul16391217184115"><li id="rds_20_0001__en-us_topic_0000001789916316_li363951734111">URI format<p id="rds_20_0001__en-us_topic_0000001789916316_p119751919257"><a name="rds_20_0001__en-us_topic_0000001789916316_li363951734111"></a><a name="en-us_topic_0000001789916316_li363951734111"></a>POST https://{<em id="rds_20_0001__en-us_topic_0000001789916316_i2135182742516">Endpoint</em>}/v3/{project_id}/instances/{instance_id}/sql-limit</p>
|
|
</li></ul>
|
|
<ul id="rds_20_0001__en-us_topic_0000001789916316_ul49831254144655"><li id="rds_20_0001__en-us_topic_0000001789916316_li15430535">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="rds_20_0001__en-us_topic_0000001789916316_table4657088" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="rds_20_0001__en-us_topic_0000001789916316_row60083059"><th align="left" class="cellrowborder" valign="top" width="20.93%" id="mcps1.3.3.3.1.1.2.4.1.1"><p id="rds_20_0001__en-us_topic_0000001789916316_p34889605"><strong id="rds_20_0001__b12537172511422">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.6%" id="mcps1.3.3.3.1.1.2.4.1.2"><p id="rds_20_0001__en-us_topic_0000001789916316_p7485743"><strong id="rds_20_0001__b147442904215">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="62.470000000000006%" id="mcps1.3.3.3.1.1.2.4.1.3"><p id="rds_20_0001__en-us_topic_0000001789916316_p2365466"><strong id="rds_20_0001__b1847883084210">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="rds_20_0001__en-us_topic_0000001789916316_row57385070"><td class="cellrowborder" valign="top" width="20.93%" headers="mcps1.3.3.3.1.1.2.4.1.1 "><p id="rds_20_0001__en-us_topic_0000001789916316_p69633355250">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.6%" headers="mcps1.3.3.3.1.1.2.4.1.2 "><p id="rds_20_0001__en-us_topic_0000001789916316_p13963113520251">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="62.470000000000006%" headers="mcps1.3.3.3.1.1.2.4.1.3 "><p id="rds_20_0001__p30492010">Specifies the project ID of a tenant in a region.</p>
|
|
<p id="rds_20_0001__p7139608914">For details about how to obtain the project ID, see <a href="rds_03_0002.html">Obtaining a Project ID</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="rds_20_0001__en-us_topic_0000001789916316_row2864326155157"><td class="cellrowborder" valign="top" width="20.93%" headers="mcps1.3.3.3.1.1.2.4.1.1 "><p id="rds_20_0001__en-us_topic_0000001789916316_p3963163516252">instance_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.6%" headers="mcps1.3.3.3.1.1.2.4.1.2 "><p id="rds_20_0001__en-us_topic_0000001789916316_p20963335192520">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="62.470000000000006%" headers="mcps1.3.3.3.1.1.2.4.1.3 "><p id="rds_20_0001__en-us_topic_0000001789916316_p64450739155220">Instance ID.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="rds_20_0001__en-us_topic_0000001789916316_section3074340117316"><h4 class="sectiontitle">Request</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="rds_20_0001__table12536623333" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request header parameters</caption><thead align="left"><tr id="rds_20_0001__row153612211337"><th align="left" class="cellrowborder" valign="top" width="19.7%" id="mcps1.3.4.2.2.5.1.1"><p id="rds_20_0001__p95111733143318">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="13.780000000000001%" id="mcps1.3.4.2.2.5.1.2"><p id="rds_20_0001__p13511123373311">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="12.959999999999999%" id="mcps1.3.4.2.2.5.1.3"><p id="rds_20_0001__p125111433133312">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="53.559999999999995%" id="mcps1.3.4.2.2.5.1.4"><p id="rds_20_0001__p551110331335">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="rds_20_0001__row353717218338"><td class="cellrowborder" valign="top" width="19.7%" headers="mcps1.3.4.2.2.5.1.1 "><p id="rds_20_0001__p18511533163317">Content-Type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.780000000000001%" headers="mcps1.3.4.2.2.5.1.2 "><p id="rds_20_0001__p13511153333312">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.959999999999999%" headers="mcps1.3.4.2.2.5.1.3 "><p id="rds_20_0001__p55111833183319">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.559999999999995%" headers="mcps1.3.4.2.2.5.1.4 "><p id="rds_20_0001__p35111331332">The content type.</p>
|
|
<p id="rds_20_0001__p1351133311330">The default value is <strong id="rds_20_0001__b105111133143310">application/json</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="rds_20_0001__row05378213331"><td class="cellrowborder" valign="top" width="19.7%" headers="mcps1.3.4.2.2.5.1.1 "><p id="rds_20_0001__p1163015550331">X-Auth-Token</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.780000000000001%" headers="mcps1.3.4.2.2.5.1.2 "><p id="rds_20_0001__p1963035563316">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.959999999999999%" headers="mcps1.3.4.2.2.5.1.3 "><p id="rds_20_0001__p1630105520331">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.559999999999995%" headers="mcps1.3.4.2.2.5.1.4 "><p id="rds_20_0001__p1086851153317">Specifies the user token.</p>
|
|
<p id="rds_20_0001__p1057635831">The user token is a response to the API used to <a href="https://docs.otc.t-systems.com/en-us/api/iam/en-us_topic_0057845583.html" target="_blank" rel="noopener noreferrer">obtain a user token</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="rds_20_0001__en-us_topic_0000001789916316_table156101520194220" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Parameters</caption><thead align="left"><tr id="rds_20_0001__en-us_topic_0000001789916316_row5679132013427"><th align="left" class="cellrowborder" valign="top" width="16.43%" id="mcps1.3.4.3.2.5.1.1"><p id="rds_20_0001__en-us_topic_0000001789916316_p66795203422"><strong id="rds_20_0001__b6648104764214">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="13.03%" id="mcps1.3.4.3.2.5.1.2"><p id="rds_20_0001__en-us_topic_0000001789916316_p66798203421"><strong id="rds_20_0001__b27134904217">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="12.91%" id="mcps1.3.4.3.2.5.1.3"><p id="rds_20_0001__en-us_topic_0000001789916316_p8679152011425"><strong id="rds_20_0001__b15418518429">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.63%" id="mcps1.3.4.3.2.5.1.4"><p id="rds_20_0001__en-us_topic_0000001789916316_p8679112016428"><strong id="rds_20_0001__b2080815212426">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="rds_20_0001__en-us_topic_0000001789916316_row19679172018426"><td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.4.3.2.5.1.1 "><p id="rds_20_0001__p16461172033412">db_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.03%" headers="mcps1.3.4.3.2.5.1.2 "><p id="rds_20_0001__p24611208343">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.91%" headers="mcps1.3.4.3.2.5.1.3 "><p id="rds_20_0001__p0461132016346">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.63%" headers="mcps1.3.4.3.2.5.1.4 "><p id="rds_20_0001__p20461112063411">Database name. For example: "<strong id="rds_20_0001__b2044683010394">postgres</strong>".</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="rds_20_0001__en-us_topic_0000001789916316_row167912013425"><td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.4.3.2.5.1.1 "><p id="rds_20_0001__p184611320113414">query_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.03%" headers="mcps1.3.4.3.2.5.1.2 "><p id="rds_20_0001__p174611820163415">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.91%" headers="mcps1.3.4.3.2.5.1.3 "><p id="rds_20_0001__p04611202345">Long</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.63%" headers="mcps1.3.4.3.2.5.1.4 "><p id="rds_20_0001__p9461120153420">Internal hash code calculated by the SQL parse tree. The default value is <strong id="rds_20_0001__b4667193655">0</strong>. The value range is from -9223372036854775808 to 9223372036854775807.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="rds_20_0001__en-us_topic_0000001789916316_row1768013208423"><td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.4.3.2.5.1.1 "><p id="rds_20_0001__p946142013348">query_string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.03%" headers="mcps1.3.4.3.2.5.1.2 "><p id="rds_20_0001__p204619206347">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.91%" headers="mcps1.3.4.3.2.5.1.3 "><p id="rds_20_0001__p84611320103411">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.63%" headers="mcps1.3.4.3.2.5.1.4 "><p id="rds_20_0001__p7461112016347">Text format of an SQL statement. Only either <strong id="rds_20_0001__b104564360242">query_id</strong> or <strong id="rds_20_0001__b11136133910241">query_string</strong> can be specified.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="rds_20_0001__en-us_topic_0000001789916316_row1068014202425"><td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.4.3.2.5.1.1 "><p id="rds_20_0001__p6461172043414">max_concurrency</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.03%" headers="mcps1.3.4.3.2.5.1.2 "><p id="rds_20_0001__p1046142003417">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.91%" headers="mcps1.3.4.3.2.5.1.3 "><p id="rds_20_0001__p1946142015343">Integer</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.63%" headers="mcps1.3.4.3.2.5.1.4 "><p id="rds_20_0001__p2046115204346">Number of SQL statements that can be executed at the same time. If the value is less than or equal to 0, the number is not limited. The default value is <strong id="rds_20_0001__b31331417191318">0</strong>. The value range is from -1 to 50000.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="rds_20_0001__en-us_topic_0000001789916316_row10680112084214"><td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.4.3.2.5.1.1 "><p id="rds_20_0001__p4461162011344">max_waiting</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.03%" headers="mcps1.3.4.3.2.5.1.2 "><p id="rds_20_0001__p14461112013343">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.91%" headers="mcps1.3.4.3.2.5.1.3 "><p id="rds_20_0001__p4461162073415">Integer</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.63%" headers="mcps1.3.4.3.2.5.1.4 "><p id="rds_20_0001__p646182016347">Maximum waiting time, in seconds.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="rds_20_0001__en-us_topic_0000001789916316_row1468019206423"><td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.4.3.2.5.1.1 "><p id="rds_20_0001__p1461820183417">search_path</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.03%" headers="mcps1.3.4.3.2.5.1.2 "><p id="rds_20_0001__p9461202019341">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.91%" headers="mcps1.3.4.3.2.5.1.3 "><p id="rds_20_0001__p64611420183419">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.63%" headers="mcps1.3.4.3.2.5.1.4 "><p id="rds_20_0001__p046213203340">Schema search order set for names that are not schema-qualified. The default value is <strong id="rds_20_0001__b173231021642">public</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="rds_20_0001__section1289114129613"><h4 class="sectiontitle">Example Request</h4><p id="rds_20_0001__p521514182069">Add a SQL throttling rule for a database.</p>
|
|
<pre class="screen" id="rds_20_0001__screen342218341564">POST https://rds.eu-de.otc.t-systems.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/49b9dd1d6f464ba4bc91df5cbd2e52ebin03/sql-limit
|
|
{
|
|
"db_name" : "postgres",
|
|
"query_id" : 1,
|
|
"max_concurrency" : 10,
|
|
"max_waiting" : 10,
|
|
"search_path" : "public"
|
|
}</pre>
|
|
</div>
|
|
<div class="section" id="rds_20_0001__en-us_topic_0000001789916316_section28521534113742"><h4 class="sectiontitle">Response</h4><ul id="rds_20_0001__en-us_topic_0000001789916316_ul12573920"><li id="rds_20_0001__en-us_topic_0000001789916316_li46056421">Normal response
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="rds_20_0001__en-us_topic_0000001789916316_table32267243" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Parameters</caption><thead align="left"><tr id="rds_20_0001__en-us_topic_0000001789916316_row9230088"><th align="left" class="cellrowborder" valign="top" width="22.5022502250225%" id="mcps1.3.6.2.1.1.2.4.1.1"><p id="rds_20_0001__en-us_topic_0000001789916316_p9439626"><strong id="rds_20_0001__b179321210122511">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="29.24292429242924%" id="mcps1.3.6.2.1.1.2.4.1.2"><p id="rds_20_0001__en-us_topic_0000001789916316_p26412257"><strong id="rds_20_0001__b19529141213256">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="48.254825482548256%" id="mcps1.3.6.2.1.1.2.4.1.3"><p id="rds_20_0001__en-us_topic_0000001789916316_p59018101"><strong id="rds_20_0001__b0779111819254">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="rds_20_0001__en-us_topic_0000001789916316_row15736877"><td class="cellrowborder" valign="top" width="22.5022502250225%" headers="mcps1.3.6.2.1.1.2.4.1.1 "><p id="rds_20_0001__p1531974633513">resp</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.24292429242924%" headers="mcps1.3.6.2.1.1.2.4.1.2 "><p id="rds_20_0001__p113192046123517">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="48.254825482548256%" headers="mcps1.3.6.2.1.1.2.4.1.3 "><p id="rds_20_0001__en-us_topic_0000001835093082_en-us_topic_0000001818123618_p8319746113518">Returns <strong id="rds_20_0001__b1831403194812">successful</strong> if the calling is successful.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="rds_20_0001__en-us_topic_0000001789916316_ul16665627"><li id="rds_20_0001__en-us_topic_0000001789916316_li15772917">Example normal response<pre class="screen" id="rds_20_0001__screen545185653513">{
|
|
"resp" : "successful"
|
|
}</pre>
|
|
</li><li id="rds_20_0001__en-us_topic_0000001789916316_li28023262501">Abnormal response<p id="rds_20_0001__p46896054"><a name="rds_20_0001__en-us_topic_0000001789916316_li28023262501"></a><a name="en-us_topic_0000001789916316_li28023262501"></a>For details, see <a href="en-us_topic_0032488197.html">Abnormal Request Results</a>.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="rds_20_0001__section4778540915440"><h4 class="sectiontitle">Status Code</h4><ul id="rds_20_0001__en-us_topic_0032347778_ul7858132212142"><li id="rds_20_0001__en-us_topic_0032347778_li58581622171411">Normal<p id="rds_20_0001__en-us_topic_0032347778_p1040982941020"><a name="rds_20_0001__en-us_topic_0032347778_li58581622171411"></a><a name="en-us_topic_0032347778_li58581622171411"></a>200</p>
|
|
</li><li id="rds_20_0001__en-us_topic_0032347778_li11583183218149">Abnormal<p id="rds_20_0001__en-us_topic_0032347778_p0723374409"><a name="rds_20_0001__en-us_topic_0032347778_li11583183218149"></a><a name="en-us_topic_0032347778_li11583183218149"></a>For details, see <a href="en-us_topic_0032488240.html">Status Codes</a>.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="rds_20_0001__section1183074220016"><h4 class="sectiontitle">Error Code</h4><p id="rds_20_0001__en-us_topic_0032347778_p19357163913406">For details, see <a href="en-us_topic_0032488241.html">Error Codes</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rds_20_0000.html">SQL Throttling (RDS for PostgreSQL)</a></div>
|
|
</div>
|
|
</div>
|
|
|