Files
doc-exports/docs/dws/dev/dws_04_0401.html
luhuayi 177cd61a57 DWS DEVG 910.211 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: luhuayi <luhuayi@huawei.com>
Co-committed-by: luhuayi <luhuayi@huawei.com>
2025-05-05 07:44:03 +00:00

45 lines
8.7 KiB
HTML

<a name="EN-US_TOPIC_0000002088892813"></a><a name="EN-US_TOPIC_0000002088892813"></a>
<h1 class="topictitle1">Overview</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_p1093743282619">Database performance tuning is the process of optimizing database system configuration and SQL queries to improve database performance and efficiency. The purpose includes eliminating performance bottlenecks, reducing response times, increasing throughput and resource utilization, cutting costs, and improving system stability.</p>
<p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_p4514152818221">This section provides comprehensive guidance for DBAs on performance diagnosis, system tuning, and SQL tuning, as well as practical examples of SQL tuning.</p>
<div class="section" id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_section659915241276"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_ul108771858192715"><li id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_li2877155802715">Database performance tuning is a complex and intricate process. To achieve the optimal performance and efficiency, performance tuning must take into consideration multiple factors, such as hardware, software, queries, configuration, and data structures. Engineers performing the performance tuning must be familiar with how database systems work in great detail, including a deep understanding of the system software architecture, software and hardware configurations, database configuration parameters, concurrency control, query handling, and database applications.</li><li class="ext" id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_li2877458122713">Performance tuning sometimes requires a cluster restart, which may interrupt services. To avoid that, you are advised to schedule performance tuning tasks that require a cluster restart to occur during off-peak hours.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_s069dfd89efc9418db5d143c10de8ece3"><h4 class="sectiontitle">Performance Tuning Process</h4><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a1034c34acc8245d0bf3b10cbb4ad235e"><a href="#EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_f64f52b18636244eb93a7de59c93fd086">Figure 1</a> illustrates the performance tuning process.</p>
<div class="fignone" id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_f64f52b18636244eb93a7de59c93fd086"><a name="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_f64f52b18636244eb93a7de59c93fd086"></a><a name="en-us_topic_0000001233883279_f64f52b18636244eb93a7de59c93fd086"></a><span class="figcap"><b>Figure 1 </b><span id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_text1949206915">GaussDB(DWS)</span> performance tuning</span><br><span><img class="vsd" id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_image1942317111712" src="figure/en-us_image_0000001188482356.png"></span></div>
<p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a421b2263ebdb408c897bde87978bfd1a"><a href="#EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_tc9d84325e32a4d07a7f18e42cea41baa">Table 1</a> gives a brief introduction to each phase of the performance tuning process.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_tc9d84325e32a4d07a7f18e42cea41baa"></a><a name="en-us_topic_0000001233883279_tc9d84325e32a4d07a7f18e42cea41baa"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_tc9d84325e32a4d07a7f18e42cea41baa" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Phase-by-phase introduction to <span id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_text1010934770">GaussDB(DWS)</span> performance tuning</caption><thead align="left"><tr id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_r26b2b4153ef24fff8ae17dabc7f1c274"><th align="left" class="cellrowborder" valign="top" width="26%" id="mcps1.3.4.5.2.3.1.1"><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a6dbf8e93c5d148f384a4cd170c47f56f">Phase</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="74%" id="mcps1.3.4.5.2.3.1.2"><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a408cb0b6db434478a6e8827b09c7859c">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_r95ae147492a64ded9b47074b2cd331bb"><td class="cellrowborder" valign="top" width="26%" headers="mcps1.3.4.5.2.3.1.1 "><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a73c4ed3462ee409f93f862336a146ab4"><a href="dws_04_0403.html#EN-US_TOPIC_0000002052655422">Performance Diagnosis</a></p>
</td>
<td class="cellrowborder" valign="top" width="74%" headers="mcps1.3.4.5.2.3.1.2 "><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a108b1b06f9884438b2850674a284b1a9">Obtain the CPU, memory, I/O, and network resource usage of each node to check whether these resources are fully utilized and whether any performance bottlenecks exist.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_r43b79c637a044a10a2581a7c74c9c084"><td class="cellrowborder" valign="top" width="26%" headers="mcps1.3.4.5.2.3.1.1 "><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a39c88c94b26442ffb95b5de0a0ccba38"><a href="dws_04_0414.html#EN-US_TOPIC_0000002088892829">System Optimization</a></p>
</td>
<td class="cellrowborder" valign="top" width="74%" headers="mcps1.3.4.5.2.3.1.2 "><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a427e7b1cf9054d119cd8168280c9fe95">Perform OS and database system-level performance tuning to achieve better utilization of existing CPU, memory, I/O, and network resources, prevent resource conflicts, and improve query throughput.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_r5229af0fbf414a37b35a45341899777a"><td class="cellrowborder" valign="top" width="26%" headers="mcps1.3.4.5.2.3.1.1 "><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a827becdeb67f46639b3a2299367d488a"><a href="dws_04_0430.html#EN-US_TOPIC_0000002052655446">SQL Tuning</a></p>
</td>
<td class="cellrowborder" valign="top" width="74%" headers="mcps1.3.4.5.2.3.1.2 "><p id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_a79534111bf044b1a89d4b24a6287a16f">Analyze the SQL statements used and determine whether any optimization can be performed. Analysis of SQL statements comprises:</p>
<ul id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_ucfab8524ea55432d9f30ad7269f700e1"><li id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_l414272dcffee47c6a447729d662a4a73">Generating table statistics using <strong id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_b24461120817026">ANALYZE</strong>: The <strong id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_b131809284217026">ANALYZE</strong> statement collects statistics about the database table content. Statistical results are stored in the system catalog <strong id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_b112331698617026">PG_STATISTIC</strong>. The execution plan generator uses these statistics to determine which one is the most effective execution plan.</li><li id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_lb842176ad9e74befa48bf4833656124f">Analyzing the execution plan: The <strong id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_b842352706152513">EXPLAIN</strong> statement displays the execution plan of SQL statements, and the <strong id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_b84235270615263">EXPLAIN PERFORMANCE</strong> statement displays the execution time of each operator in SQL statements.</li><li id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_l78651b9757ad44f4abb9ba24b57a631c">Identifying the root causes of issues: Identify possible causes by analyzing the execution plan and perform specific optimization by modifying database-level SQL optimization parameters.</li><li id="EN-US_TOPIC_0000002088892813__en-us_topic_0000001233883279_lac62e60980d3435a9bb267579142ab47">Compiling better SQL statements: Compile better SQL statements in the scenarios, such as cache of intermediate and temporary data for complex queries, result set cache, and result set combination.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0400.html">GaussDB(DWS) Performance Tuning</a></div>
</div>
</div>