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>
40 lines
5.9 KiB
HTML
40 lines
5.9 KiB
HTML
<a name="slow_query_log-pg"></a><a name="slow_query_log-pg"></a>
|
|
|
|
<h1 class="topictitle1">Viewing Slow Query Logs</h1>
|
|
<div id="body1548129453777"><div class="section" id="slow_query_log-pg__section61232893165332"><h4 class="sectiontitle"><strong id="slow_query_log-pg__b4240184122014">Scenarios</strong></h4><p id="slow_query_log-pg__p154821641155412">Slow query logs record statements that exceed the <span class="parmname" id="slow_query_log-pg__parmname998610492019"><b>log_min_duration_statement</b></span> value. You can view log details to identify statements that are slowly executed and optimize the statements. </p>
|
|
<div class="p" id="slow_query_log-pg__p1036918352521"><span id="slow_query_log-pg__text1079938519">RDS</span> supports the following statement types:<ul id="slow_query_log-pg__ul15606971754"><li id="slow_query_log-pg__li36061471155">SELECT</li><li id="slow_query_log-pg__li56061171254">INSERT</li><li id="slow_query_log-pg__li760677251">UPDATE</li><li id="slow_query_log-pg__li96061771453">DELETE</li><li id="slow_query_log-pg__li14606197250">CREATE</li><li id="slow_query_log-pg__li1970217182144">DROP</li><li id="slow_query_log-pg__li739082411411">ALTER</li><li id="slow_query_log-pg__li1280114331415">DO</li><li id="slow_query_log-pg__li614014615146">CALL</li><li id="slow_query_log-pg__li1262165914143">COPY</li></ul>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="slow_query_log-pg__section121471583582"><h4 class="sectiontitle">Parameter Description</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="slow_query_log-pg__table1455312241604" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters related to PostgreSQL slow queries</caption><thead align="left"><tr id="slow_query_log-pg__row1755318241201"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.2.2.2.3.1.1"><p id="slow_query_log-pg__p455311242020"><strong id="slow_query_log-pg__b842352706181819">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="70%" id="mcps1.3.2.2.2.3.1.2"><p id="slow_query_log-pg__p15534249012"><strong id="slow_query_log-pg__b14271343152219">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="slow_query_log-pg__row145532241400"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.2.2.2.3.1.1 "><p id="slow_query_log-pg__p26741582414">log_min_duration_statement</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.2.2.2.3.1.2 "><p id="slow_query_log-pg__p13674185817412">Specifies how many milliseconds a query has to run before it has to be logged. </p>
|
|
</td>
|
|
</tr>
|
|
<tr id="slow_query_log-pg__row895701512718"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.2.2.2.3.1.1 "><p id="slow_query_log-pg__p65464218105">log_statement</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.2.2.2.3.1.2 "><p id="slow_query_log-pg__p69655384203">Specifies the statement type. The value can be <strong id="slow_query_log-pg__b15462171192817">none</strong>, <strong id="slow_query_log-pg__b57341047281">ddl</strong>, <strong id="slow_query_log-pg__b27221133287">mod</strong>, or <strong id="slow_query_log-pg__b1497212532819">all</strong>.</p>
|
|
<p id="slow_query_log-pg__p7546102151013">The default value is <strong id="slow_query_log-pg__b16925713102811">none</strong>. If you change the value to <strong id="slow_query_log-pg__b414493142815">all</strong>, the database log format changes and slow query logs fail to be parsed.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="slow_query_log-pg__section467223910567"><h4 class="sectiontitle">Viewing Log Details</h4><ol id="slow_query_log-pg__ol105901371552"><li id="slow_query_log-pg__li17616348171"><span>Log in to the management console.</span></li><li id="slow_query_log-pg__li146168481712"><span>Click <span><img id="slow_query_log-pg__rds_modify_instance_name_en-us_topic_0192953815_image192529212293" src="en-us_image_0000001470260233.png"></span> in the upper left corner and select a region and a project.</span></li><li id="slow_query_log-pg__li96167481711"><span>Click <strong id="slow_query_log-pg__rds_modify_instance_name_b171171523153019">Service List</strong>. Under <strong id="slow_query_log-pg__rds_modify_instance_name_b111722319302">Database</strong>, click <strong id="slow_query_log-pg__rds_modify_instance_name_b15118152363010">Relational Database Service</strong>. The RDS console is displayed.</span></li><li id="slow_query_log-pg__li76061771959"><span>On the <strong id="slow_query_log-pg__b1737691316234">Instances</strong> page, click the target DB instance.</span></li><li id="slow_query_log-pg__li99031629175618"><span>In the navigation pane on the left, choose <strong id="slow_query_log-pg__b122131396596">Logs</strong>. On the <strong id="slow_query_log-pg__b20214193918591">Slow Query Logs</strong> page, view details about slow query logs.</span><p><ul id="slow_query_log-pg__ul58719314279"><li id="slow_query_log-pg__li28713319278">You can view the slow query log records of a specified execution statement type or a specific time period.</li><li id="slow_query_log-pg__li5752432142716">The <span class="parmname" id="slow_query_log-pg__parmname16832850182710"><b>log_min_duration_statement</b></span> parameter determines when a slow query log is recorded. However, changes to this parameter do not affect already recorded logs. If <span class="parmname" id="slow_query_log-pg__parmname1326163318482"><b>log_min_duration_statement</b></span> is changed from 1s to 0.1s, none of the previously recorded logs that do not meet the new threshold are deleted. For example, a 1.5s SQL statement that was recorded when the threshold was 1s will not be deleted now that the new threshold is 2s.</li></ul>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rds_08_001.html">Log Management</a></div>
|
|
</div>
|
|
</div>
|
|
|