Yang, Tong 3f5759eed2 MRS comp-lts 2.0.38.SP20 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2023-01-19 17:08:45 +00:00

116 lines
13 KiB
HTML

<a name="mrs_01_24230"></a><a name="mrs_01_24230"></a>
<h1 class="topictitle1">Slow Query Statement Monitoring</h1>
<div id="body8662426"><div class="section" id="mrs_01_24230__en-us_topic_0000001173470902_section7556193865411"><h4 class="sectiontitle">Scenario</h4><p id="mrs_01_24230__en-us_topic_0000001173470902_p10783204065417">The SQL statement query in ClickHouse is slow because the conditions such as partitions, where conditions, and indexes of SQL statements are set improperly. As a result, the overall performance of the database is affected. To solve this problem, MRS provides the function of monitoring slow ClickHouse query statements.</p>
</div>
<div class="section" id="mrs_01_24230__en-us_topic_0000001173470902_section11448739153011"><h4 class="sectiontitle">Ongoing Slow Queries</h4><p id="mrs_01_24230__en-us_topic_0000001173470902_p92258362411">You can query information about slow SQL statements that are being executed but do not return any result.</p>
<ul id="mrs_01_24230__en-us_topic_0000001173470902_ul5425158194315"><li id="mrs_01_24230__en-us_topic_0000001173470902_li1642519584434"><strong id="mrs_01_24230__en-us_topic_0000001173470902_b10925135416578">Procedure</strong><p id="mrs_01_24230__en-us_topic_0000001173470902_p418216121929">Log in to FusionInsight Manager and choose <strong id="mrs_01_24230__en-us_topic_0000001173470902_b275511515582">Cluster</strong> &gt; <strong id="mrs_01_24230__en-us_topic_0000001173470902_b49869755816">Services</strong> &gt; <strong id="mrs_01_24230__en-us_topic_0000001173470902_b10351813115816">ClickHouse</strong>. On the displayed page, click the <strong id="mrs_01_24230__en-us_topic_0000001173470902_b02368183584">Query Management</strong> tab and then the <strong id="mrs_01_24230__en-us_topic_0000001173470902_b51841815915">Ongoing Slow Queries</strong> tab.</p>
</li></ul>
<ul id="mrs_01_24230__en-us_topic_0000001173470902_ul27252074411"><li id="mrs_01_24230__en-us_topic_0000001173470902_li872500134417"><strong id="mrs_01_24230__en-us_topic_0000001173470902_b12523205514119">Parameters</strong>
<div class="tablenoborder"><a name="mrs_01_24230__en-us_topic_0000001173470902_table1578619528431"></a><a name="en-us_topic_0000001173470902_table1578619528431"></a><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_24230__en-us_topic_0000001173470902_table1578619528431" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Slow query parameters</caption><thead align="left"><tr id="mrs_01_24230__en-us_topic_0000001173470902_row8786752194310"><th align="left" class="cellrowborder" valign="top" width="15.76%" id="mcps1.3.2.4.1.2.2.3.1.1"><p id="mrs_01_24230__en-us_topic_0000001173470902_p1786125214436">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="84.24000000000001%" id="mcps1.3.2.4.1.2.2.3.1.2"><p id="mrs_01_24230__en-us_topic_0000001173470902_p678618524439">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_24230__en-us_topic_0000001173470902_row11786175254318"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p3786052184313">Server Node IP Address</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p14786125215435">IP address of the ClickHouseServer instance. To view the IP address, log in to FusionInsight Manager and choose <strong id="mrs_01_24230__en-us_topic_0000001173470902_b53144151612">Cluster</strong> &gt; <strong id="mrs_01_24230__en-us_topic_0000001173470902_b84023176620">Services</strong> &gt; <strong id="mrs_01_24230__en-us_topic_0000001173470902_b5202182214617">ClickHouse</strong>. On the displayed page, click the <strong id="mrs_01_24230__en-us_topic_0000001173470902_b230714255611">Instance</strong> tab.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row14786252104310"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p47867526431">Query ID</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p11786105234314">Unique ID generated internally.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row2078635284313"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p1786155294311">Query</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p17786165284313">Slow query SQL statement.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row147352569448"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p4735145664416">Start Time</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p5735205618442">Time when the execution of a slow query SQL statement starts.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row1248518612454"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p1870715180545">End Time</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p57071418135412">Time when the execution of a slow query SQL statement ends.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row13814153845412"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p6814438175411">Duration (s)</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p281463875417">Total execution time of a slow query SQL statement, in seconds.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row8171310165514"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p7171201013553">User</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p18171191065510">ClickHouse user who executes a slow query SQL statement.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row1868152795515"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p1368152795514">Client IP Address</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p186810272557">IP address of the client that submits a slow query SQL statement.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row162327522552"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p1180226175617">Memory Used (MB)</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p12232552135517">Memory used by a slow query SQL statement, in MB.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row844582165711"><td class="cellrowborder" valign="top" width="15.76%" headers="mcps1.3.2.4.1.2.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p17445152165711">Operation</p>
</td>
<td class="cellrowborder" valign="top" width="84.24000000000001%" headers="mcps1.3.2.4.1.2.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p1744532185716">You can click <strong id="mrs_01_24230__en-us_topic_0000001173470902_b15491926173216">Terminate</strong> to terminate the slow query using a slow query SQL statement.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="mrs_01_24230__en-us_topic_0000001173470902_li1655547530"><strong id="mrs_01_24230__en-us_topic_0000001173470902_b1046841643712">Filter conditions</strong><p id="mrs_01_24230__en-us_topic_0000001173470902_p15447175720112">Select the query condition as required and filter the query results.</p>
<p id="mrs_01_24230__en-us_topic_0000001173470902_p162594111112"><span><img id="mrs_01_24230__image371014172415" src="en-us_image_0000001441092221.png"></span></p>
<div class="tablenoborder"><a name="mrs_01_24230__en-us_topic_0000001173470902_table12626134121116"></a><a name="en-us_topic_0000001173470902_table12626134121116"></a><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_24230__en-us_topic_0000001173470902_table12626134121116" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Filter conditions</caption><thead align="left"><tr id="mrs_01_24230__en-us_topic_0000001173470902_row6625144113115"><th align="left" class="cellrowborder" valign="top" width="21.25%" id="mcps1.3.2.4.2.4.2.3.1.1"><p id="mrs_01_24230__en-us_topic_0000001173470902_p1062516413112">Condition</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="78.75%" id="mcps1.3.2.4.2.4.2.3.1.2"><p id="mrs_01_24230__en-us_topic_0000001173470902_p862584191120">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_24230__en-us_topic_0000001173470902_row17625164171116"><td class="cellrowborder" valign="top" width="21.25%" headers="mcps1.3.2.4.2.4.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p20625174110113">Slow query duration exceeding</p>
</td>
<td class="cellrowborder" valign="top" width="78.75%" headers="mcps1.3.2.4.2.4.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p15625941141118">Filters the slow queries based on the duration.</p>
<p id="mrs_01_24230__en-us_topic_0000001173470902_p3625641181114">The value can be <strong id="mrs_01_24230__en-us_topic_0000001173470902_b06538894015">3 (s)</strong>, <strong id="mrs_01_24230__en-us_topic_0000001173470902_b20634311154015">9 (s)</strong>, <strong id="mrs_01_24230__en-us_topic_0000001173470902_b103641714194019">15 (s)</strong>, or <strong id="mrs_01_24230__en-us_topic_0000001173470902_b2237181714406">25 (s)</strong>.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row3626144121110"><td class="cellrowborder" valign="top" width="21.25%" headers="mcps1.3.2.4.2.4.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p176255415112">By Query ID</p>
</td>
<td class="cellrowborder" valign="top" width="78.75%" headers="mcps1.3.2.4.2.4.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p96261941111120">Filters the slow queries based on the query ID.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row1662684115117"><td class="cellrowborder" valign="top" width="21.25%" headers="mcps1.3.2.4.2.4.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p15626184117115">By User</p>
</td>
<td class="cellrowborder" valign="top" width="78.75%" headers="mcps1.3.2.4.2.4.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p3626341201112">Filters the slow queries based on the ClickHouse user.</p>
</td>
</tr>
<tr id="mrs_01_24230__en-us_topic_0000001173470902_row9626154191113"><td class="cellrowborder" valign="top" width="21.25%" headers="mcps1.3.2.4.2.4.2.3.1.1 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p20626204119118">By Client IP Address</p>
</td>
<td class="cellrowborder" valign="top" width="78.75%" headers="mcps1.3.2.4.2.4.2.3.1.2 "><p id="mrs_01_24230__en-us_topic_0000001173470902_p5626174110111">Filters the slow queries based on the IP address of the client that submits slow query SQL statements.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="mrs_01_24230__en-us_topic_0000001173470902_section983101817231"><h4 class="sectiontitle">Completed Queries</h4><p id="mrs_01_24230__en-us_topic_0000001173470902_p1264912296233">You can query information about slow SQL statements that have been executed and returned results.</p>
<p id="mrs_01_24230__en-us_topic_0000001173470902_p1930682565215">Log in to FusionInsight Manager and choose <strong id="mrs_01_24230__en-us_topic_0000001173470902_b1937493275911">Cluster</strong> &gt; <strong id="mrs_01_24230__en-us_topic_0000001173470902_b62313917599">Services</strong> &gt; <strong id="mrs_01_24230__en-us_topic_0000001173470902_b16224205012595">ClickHouse</strong>. On the displayed page, click the <strong id="mrs_01_24230__en-us_topic_0000001173470902_b106062010901">Query Management</strong> tab and then the <strong id="mrs_01_24230__en-us_topic_0000001173470902_b1448711311607">Completed Queries</strong> tab.</p>
<p id="mrs_01_24230__en-us_topic_0000001173470902_p86990785318">For details about slow query parameters and filter conditions, see <a href="#mrs_01_24230__en-us_topic_0000001173470902_table1578619528431">Table 1</a> and <a href="#mrs_01_24230__en-us_topic_0000001173470902_table12626134121116">Table 2</a>, respectively.</p>
</div>
<p id="mrs_01_24230__en-us_topic_0000001173470902_p8060118"></p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_24229.html">Monitoring of Slow ClickHouse Query Statements and Replication Table Data Synchronization</a></div>
</div>
</div>