forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Wang , Deng Ke <wangdengke2@huawei.com> Co-committed-by: Wang , Deng Ke <wangdengke2@huawei.com>
200 lines
16 KiB
HTML
200 lines
16 KiB
HTML
<a name="en-us_topic_0037147511"></a><a name="en-us_topic_0037147511"></a>
|
|
|
|
<h1 class="topictitle1">Querying Database Slow Logs</h1>
|
|
<div id="body1473069794004"><div class="section" id="en-us_topic_0037147511__section61759636"><h4 class="sectiontitle">Function</h4><p id="en-us_topic_0037147511__p33831530">This API is used to query database slow logs.</p>
|
|
</div>
|
|
<div class="section" id="en-us_topic_0037147511__section18965813"><h4 class="sectiontitle">URI</h4><ul id="en-us_topic_0037147511__ul55999443"><li id="en-us_topic_0037147511__li34232944">URI format<p id="en-us_topic_0037147511__p39661040"><a name="en-us_topic_0037147511__li34232944"></a><a name="li34232944"></a>PATH: /rds/v1/{project_id}/instances/{instanceId}/slowlog</p>
|
|
<p id="en-us_topic_0037147511__p3900605615503">Method: GET</p>
|
|
</li><li id="en-us_topic_0037147511__li21405046">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="en-us_topic_0037147511__table58427690" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="en-us_topic_0037147511__row1482002"><th align="left" class="cellrowborder" valign="top" width="21.11%" id="mcps1.3.2.2.2.1.2.4.1.1"><p id="en-us_topic_0037147511__p52933326"><strong id="en-us_topic_0037147511__b842352706102328_1">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="27.88%" id="mcps1.3.2.2.2.1.2.4.1.2"><p id="en-us_topic_0037147511__p59740974"><strong id="en-us_topic_0037147511__b842352706102346_1">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="51.01%" id="mcps1.3.2.2.2.1.2.4.1.3"><p id="en-us_topic_0037147511__p7180698"><strong id="en-us_topic_0037147511__b842352706163417_1">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="en-us_topic_0037147511__row44765691"><td class="cellrowborder" valign="top" width="21.11%" headers="mcps1.3.2.2.2.1.2.4.1.1 "><p id="en-us_topic_0037147511__p2142393">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="27.88%" headers="mcps1.3.2.2.2.1.2.4.1.2 "><p id="en-us_topic_0037147511__p39316155">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="51.01%" headers="mcps1.3.2.2.2.1.2.4.1.3 "><p id="en-us_topic_0037147511__p30492010">Specifies the project ID of a tenant in a region.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row5992637"><td class="cellrowborder" valign="top" width="21.11%" headers="mcps1.3.2.2.2.1.2.4.1.1 "><p id="en-us_topic_0037147511__p15641626">instanceId</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="27.88%" headers="mcps1.3.2.2.2.1.2.4.1.2 "><p id="en-us_topic_0037147511__p59012183">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="51.01%" headers="mcps1.3.2.2.2.1.2.4.1.3 "><p id="en-us_topic_0037147511__p7417132564016">Specifies the primary node ID of the DB instance.</p>
|
|
<div class="note" id="en-us_topic_0037147511__note18250133224019"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="en-us_topic_0037147511__p142501332164011">This field is not the DB instance ID. You are advised to use API v3 and the DB instance ID to perform related operations.</p>
|
|
</div></div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="en-us_topic_0037147511__ul27898002"><li id="en-us_topic_0037147511__li61827782155332">Restrictions<p id="en-us_topic_0037147511__p11601127194415"><a name="en-us_topic_0037147511__li61827782155332"></a><a name="li61827782155332"></a>Only MySQL DB instances are supported.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="en-us_topic_0037147511__section36474591"><h4 class="sectiontitle">Request</h4><ul id="en-us_topic_0037147511__ul33657489164626"><li id="en-us_topic_0037147511__li21764836175232">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="en-us_topic_0037147511__table22478116" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="en-us_topic_0037147511__row12299945"><th align="left" class="cellrowborder" valign="top" width="21.11%" id="mcps1.3.3.2.1.1.2.4.1.1"><p id="en-us_topic_0037147511__p56771492"><strong id="en-us_topic_0037147511__b842352706102328_5">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="28.64%" id="mcps1.3.3.2.1.1.2.4.1.2"><p id="en-us_topic_0037147511__p35088115"><strong id="en-us_topic_0037147511__b842352706102346_5">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50.24999999999999%" id="mcps1.3.3.2.1.1.2.4.1.3"><p id="en-us_topic_0037147511__p23565055"><strong id="en-us_topic_0037147511__b842352706163417_5">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="en-us_topic_0037147511__row53630064175338"><td class="cellrowborder" valign="top" width="21.11%" headers="mcps1.3.3.2.1.1.2.4.1.1 "><p id="en-us_topic_0037147511__p50260708175338">sftype</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.3.2.1.1.2.4.1.2 "><p id="en-us_topic_0037147511__p44585518175338">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50.24999999999999%" headers="mcps1.3.3.2.1.1.2.4.1.3 "><p id="en-us_topic_0037147511__p54657188175338">Specifies the statement type. Its value can be empty, <strong id="en-us_topic_0037147511__b842352706906">INSERT</strong>, <strong id="en-us_topic_0037147511__b8423527069010">UPDATE</strong>, <strong id="en-us_topic_0037147511__b8423527069013">SELECT</strong>, <strong id="en-us_topic_0037147511__b8423527069016">DELETE</strong>, or <strong id="en-us_topic_0037147511__b8423527069020">CREATE</strong>. If the value is empty, all statement types exist.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row50698138175338"><td class="cellrowborder" valign="top" width="21.11%" headers="mcps1.3.3.2.1.1.2.4.1.1 "><p id="en-us_topic_0037147511__p49534384175338">top</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.3.3.2.1.1.2.4.1.2 "><p id="en-us_topic_0037147511__p52862197175338">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50.24999999999999%" headers="mcps1.3.3.2.1.1.2.4.1.3 "><p id="en-us_topic_0037147511__p3481240119126">Specifies how many records are returned.</p>
|
|
<ul id="en-us_topic_0037147511__ul5678002519211"><li id="en-us_topic_0037147511__li4417707719211">If this parameter is specified, the value range is from 1 to 50.</li><li id="en-us_topic_0037147511__li261972119211">If this parameter is not specified, the first 10 records are returned.</li></ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="en-us_topic_0037147511__li57455697143540">Request example<pre class="codeblock" id="en-us_topic_0037147511__codeblock6554081794536">/rds/v1/68e3010955d748099f62a0df726fe09b/instances/02e47383-9222-4d29-bf5b-54b3013b0f71/slowlog?sftype=&top=10</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="en-us_topic_0037147511__section59835867"><h4 class="sectiontitle">Normal Response</h4><ul id="en-us_topic_0037147511__ul66273227"><li id="en-us_topic_0037147511__li59588135">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="en-us_topic_0037147511__table29752153" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Parameter description</caption><thead align="left"><tr id="en-us_topic_0037147511__row62070345"><th align="left" class="cellrowborder" valign="top" width="20.919999999999998%" id="mcps1.3.4.2.1.1.2.4.1.1"><p id="en-us_topic_0037147511__p61642077"><strong id="en-us_topic_0037147511__b842352706102328_7">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="29.21%" id="mcps1.3.4.2.1.1.2.4.1.2"><p id="en-us_topic_0037147511__p26952341"><strong id="en-us_topic_0037147511__b842352706164541_1">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="49.87%" id="mcps1.3.4.2.1.1.2.4.1.3"><p id="en-us_topic_0037147511__p35656026"><strong id="en-us_topic_0037147511__b842352706163417_7">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="en-us_topic_0037147511__row49943891183823"><td class="cellrowborder" valign="top" width="20.919999999999998%" headers="mcps1.3.4.2.1.1.2.4.1.1 "><p id="en-us_topic_0037147511__p17747976183823">slowLogList</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.21%" headers="mcps1.3.4.2.1.1.2.4.1.2 "><p id="en-us_topic_0037147511__p28299952183823">List data structure. For details, see <a href="#en-us_topic_0037147511__table66531170">Table 4</a>.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.87%" headers="mcps1.3.4.2.1.1.2.4.1.3 "><p id="en-us_topic_0037147511__p10594789183823">Indicates detailed information.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row6331999514368"><td class="cellrowborder" valign="top" width="20.919999999999998%" headers="mcps1.3.4.2.1.1.2.4.1.1 "><p id="en-us_topic_0037147511__p27570747143630">totalRecord</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.21%" headers="mcps1.3.4.2.1.1.2.4.1.2 "><p id="en-us_topic_0037147511__p18638029143630">Int</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.87%" headers="mcps1.3.4.2.1.1.2.4.1.3 "><p id="en-us_topic_0037147511__p33285367143630">Indicates the total number of records.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><a name="en-us_topic_0037147511__table66531170"></a><a name="table66531170"></a><table cellpadding="4" cellspacing="0" summary="" id="en-us_topic_0037147511__table66531170" frame="border" border="1" rules="all"><caption><b>Table 4 </b>slowLogList field data structure description</caption><thead align="left"><tr id="en-us_topic_0037147511__row12984378"><th align="left" class="cellrowborder" valign="top" width="20.73%" id="mcps1.3.4.2.1.2.2.4.1.1"><p id="en-us_topic_0037147511__p45101667"><strong id="en-us_topic_0037147511__b842352706102328_9">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="29.759999999999998%" id="mcps1.3.4.2.1.2.2.4.1.2"><p id="en-us_topic_0037147511__p29356372"><strong id="en-us_topic_0037147511__b842352706164541_3">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="49.51%" id="mcps1.3.4.2.1.2.2.4.1.3"><p id="en-us_topic_0037147511__p29055926"><strong id="en-us_topic_0037147511__b842352706163417_9">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="en-us_topic_0037147511__row4719792"><td class="cellrowborder" valign="top" width="20.73%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="en-us_topic_0037147511__p46758891">count</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.759999999999998%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="en-us_topic_0037147511__p29373839">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.51%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="en-us_topic_0037147511__p30470722">Indicates the number of executions.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row5801050"><td class="cellrowborder" valign="top" width="20.73%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="en-us_topic_0037147511__p123050">time</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.759999999999998%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="en-us_topic_0037147511__p9967070">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.51%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="en-us_topic_0037147511__p2026335">Indicates the average execution duration.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row1562610185558"><td class="cellrowborder" valign="top" width="20.73%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="en-us_topic_0037147511__p27564685185558">lockTime</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.759999999999998%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="en-us_topic_0037147511__p18147022185558">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.51%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="en-us_topic_0037147511__p60622679185558">Indicates the average waiting time before locking.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row46227617185624"><td class="cellrowborder" valign="top" width="20.73%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="en-us_topic_0037147511__p61882053185624">rowsSent</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.759999999999998%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="en-us_topic_0037147511__p46390393185624">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.51%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="en-us_topic_0037147511__p66634382185624">Indicates the average number of rows contained in a result.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row26041859185714"><td class="cellrowborder" valign="top" width="20.73%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="en-us_topic_0037147511__p62791567185714">rowsExamined</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.759999999999998%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="en-us_topic_0037147511__p52952143185714">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.51%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="en-us_topic_0037147511__p61265200185714">Indicates the average number of scanned rows.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row8051277185753"><td class="cellrowborder" valign="top" width="20.73%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="en-us_topic_0037147511__p65936923185753">database</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.759999999999998%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="en-us_topic_0037147511__p39290538185753">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.51%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="en-us_topic_0037147511__p28417034185753">Indicates the database which the slow log belongs to.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row62737284185755"><td class="cellrowborder" valign="top" width="20.73%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="en-us_topic_0037147511__p65776751185755">users</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.759999999999998%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="en-us_topic_0037147511__p26316620185755">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.51%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="en-us_topic_0037147511__p51271494185755">Indicates the account.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="en-us_topic_0037147511__row24608043185759"><td class="cellrowborder" valign="top" width="20.73%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="en-us_topic_0037147511__p60502836185759">querySample</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.759999999999998%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="en-us_topic_0037147511__p1782674185759">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.51%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="en-us_topic_0037147511__p10178909185759">Indicates the execution syntax.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="en-us_topic_0037147511__ul26818564"><li id="en-us_topic_0037147511__li40040492">Response example<pre class="codeblock" id="en-us_topic_0037147511__codeblock1595400517759">{ "slowLogList": [
|
|
{
|
|
"count": " 409 (99.76%)",
|
|
"time": "1.29",
|
|
"lockTime": " 0 ",
|
|
"rowsSent": " 0 ",
|
|
"rowsExamined": " 0 ",
|
|
"database": " ",
|
|
"users": " \trdsBackup@localhost : 100.00% (409) of query, 99.76% (409) of all users",
|
|
"querySample": "flush logs;"
|
|
},
|
|
{
|
|
"count": " 1 (0.24%)",
|
|
"time": "5.0",
|
|
"lockTime": " 0 ",
|
|
"rowsSent": " 1 ",
|
|
"rowsExamined": " 0 ",
|
|
"database": " ",
|
|
"users": " \trdsAdmin@localhost : 100.00% (1) of query, 0.24% (1) of all users",
|
|
"querySample": "select sleep(5);"
|
|
}
|
|
],
|
|
"totalRecord": 2
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="en-us_topic_0037147511__section1651899"><h4 class="sectiontitle">Abnormal Response</h4><p id="en-us_topic_0037147511__p46896054">For details, see <a href="en-us_topic_0032488197.html">Abnormal Request Results</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rds_06_0019.html">Log Information Queries</a></div>
|
|
</div>
|
|
</div>
|
|
|