<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Qing</title>
    <description>The latest articles on DEV Community by Qing (@llxq2023).</description>
    <link>https://dev.to/llxq2023</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1036207%2Fb83677db-8d6b-4edb-ba3b-61c5288d61fa.jpg</url>
      <title>DEV Community: Qing</title>
      <link>https://dev.to/llxq2023</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/llxq2023"/>
    <language>en</language>
    <item>
      <title>Performance Tuning-Analyzing Hardware Bottlenecks-Network</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 09:33:46 +0000</pubDate>
      <link>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-network-1ae7</link>
      <guid>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-network-1ae7</guid>
      <description>&lt;p&gt;You can run the &lt;strong&gt;sar&lt;/strong&gt; or &lt;strong&gt;ifconfig&lt;/strong&gt; command to check the network status on each node in openGauss and analyze whether performance bottlenecks caused by network faults occur.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checking Network Status&lt;/strong&gt;&lt;br&gt;
Check the server network status using either of the following two methods:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Log in to the server as user &lt;strong&gt;root&lt;/strong&gt; and run the following commands to check the network connection:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xU-m4DZJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eb7l2zabo9y7xlzes3aj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xU-m4DZJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eb7l2zabo9y7xlzes3aj.png" alt="Image description" width="745" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;errors&lt;/strong&gt; indicates the total number of error packets received.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;dropped&lt;/strong&gt; indicates the number of packets that have reached the ring buffer but are discarded before being copied to the memory due to system faults, for example, insufficient memory.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;overruns&lt;/strong&gt; indicates the number of packets that have been discarded from the ring buffer. They are discarded because the kernel is incapable of processing ring buffer (a.k.a. Driver Queue) transmission.&lt;br&gt;
In the command output, if the values of the three parameters keep increasing, the network is overloaded or hardware (such as NICs and memory) faults exist.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Run the &lt;strong&gt;sar&lt;/strong&gt; command to check the network connection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EX0xX_Hu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8k4qjlzisw3r2ti6i46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EX0xX_Hu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8k4qjlzisw3r2ti6i46.png" alt="Image description" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;rxkB/s&lt;/strong&gt; indicates the number of kilobytes of data received per second and &lt;strong&gt;txkB/s&lt;/strong&gt; indicates the number of those sent per second.&lt;/p&gt;

&lt;p&gt;In the command output, check whether the amount of data received and sent by any NIC has reached the upper limit.&lt;/p&gt;

&lt;p&gt;After the check, press &lt;strong&gt;Ctrl+Z&lt;/strong&gt; to exit.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>Performance Tuning-Analyzing Hardware Bottlenecks-I/O</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 09:30:03 +0000</pubDate>
      <link>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-io-4f29</link>
      <guid>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-io-4f29</guid>
      <description>&lt;p&gt;You can run the &lt;strong&gt;iostat&lt;/strong&gt; or &lt;strong&gt;pidstat&lt;/strong&gt; command, or use openGauss heath check tools to check the I/O usage and throughput on each node in openGauss and analyze whether performance bottleneck caused by I/O exists.&lt;/p&gt;

&lt;p&gt;Checking I/O Usage&lt;br&gt;
Use one of the following methods to check the server I/O:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Run the &lt;strong&gt;iostat&lt;/strong&gt; command to check the I/O usage. This command focuses on the I/O usage and the amount of data read and written on a single hard disk per second.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4zdGWoZz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9frnf9w41e4p5w8fovod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4zdGWoZz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9frnf9w41e4p5w8fovod.png" alt="Image description" width="800" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;rMB/s&lt;/strong&gt; indicates the number of megabytes of data read per second, &lt;strong&gt;wMB/s&lt;/strong&gt; indicates that of data written per second, and &lt;strong&gt;%util&lt;/strong&gt; indicates the disk usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Run the &lt;strong&gt;pidstat&lt;/strong&gt; command to check the I/O usage. This command focuses on the amount of data read and written on a single process per second.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O4ZwHjmW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g89b1fgxc36x14emgvj4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O4ZwHjmW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g89b1fgxc36x14emgvj4.png" alt="Image description" width="800" height="60"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kB_rd/s&lt;/strong&gt; indicates the number of kilobytes of data read per second, and &lt;strong&gt;kB_wr/s&lt;/strong&gt; indicates that of data written per second.&lt;/p&gt;

&lt;p&gt;Run the &lt;strong&gt;gs_checkperf&lt;/strong&gt; command as user &lt;strong&gt;omm&lt;/strong&gt; to check the I/O usage in openGauss.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ETjyPOLQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kunr32nm56qkwrhoor2z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ETjyPOLQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kunr32nm56qkwrhoor2z.png" alt="Image description" width="789" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The I/O usage, number of reads and writes, and time when data is read and written are displayed.&lt;/p&gt;

&lt;p&gt;You can also run the &lt;strong&gt;gs_checkperf –detail&lt;/strong&gt; command to query performance details of each node.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analyzing Performance Parameters&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check whether the disk usage exceeds 60%. Disk usage exceeding 60% is called high.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--28fd9ME0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wlc3a0ep5irqqnwqoiq0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--28fd9ME0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wlc3a0ep5irqqnwqoiq0.png" alt="Image description" width="144" height="39"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Perform the following operations to reduce I/O usage if the I/O usage keeps high:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.1 Reduce the number of concurrent tasks.&lt;/p&gt;

&lt;p&gt;2.2 Do VACUUM FULL for related tables.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--52G1oYSj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dou17sy4lplwizjz3ptc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--52G1oYSj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dou17sy4lplwizjz3ptc.png" alt="Image description" width="276" height="36"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G9GtxPLi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icvgtp9n4lghssqw2eu2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G9GtxPLi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icvgtp9n4lghssqw2eu2.png" alt="Image description" width="800" height="86"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>Performance Tuning-Analyzing Hardware Bottlenecks-Memory（2）</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 09:24:54 +0000</pubDate>
      <link>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-memory2-48cm</link>
      <guid>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-memory2-48cm</guid>
      <description>&lt;p&gt;&lt;strong&gt;max_prepared_transactions&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the maximum number of transactions that can stay in the &lt;strong&gt;prepared&lt;/strong&gt; state simultaneously. Increasing the value of this parameter causes openGauss to request more System V shared memory than the default configuration allows.&lt;/p&gt;

&lt;p&gt;When openGauss is deployed as an HA system, set this parameter on standby servers to a value greater than or equal to that on primary servers. Otherwise, queries will fail on the standby servers.&lt;/p&gt;

&lt;p&gt;This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 0 to 262143&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 10&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e9ITuFWj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/47f05nxnl8gjwh9m4dj0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e9ITuFWj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/47f05nxnl8gjwh9m4dj0.png" alt="Image description" width="800" height="83"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;work_mem&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the amount of memory to be used by internal sort operations and hash tables before they write data into temporary disk files. Sort operations are required for &lt;strong&gt;ORDER BY, DISTINCT&lt;/strong&gt;, and merge joins. Hash tables are used in hash joins, hash-based aggregation, and hash-based processing of &lt;strong&gt;IN&lt;/strong&gt; subqueries.&lt;/p&gt;

&lt;p&gt;In a complex query, several sort or hash operations may run in parallel; each operation will be allowed to use as much memory as this parameter specifies. If the memory is insufficient, data will be written into temporary files. In addition, several running sessions could be performing such operations concurrently. Therefore, the total memory used may be many times the value of &lt;strong&gt;work_mem&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 64 to 2147483647. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 64 MB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PLQEPhVp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kiyqepn0rylxdlfacyo4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PLQEPhVp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kiyqepn0rylxdlfacyo4.png" alt="Image description" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;query_mem&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the memory used by a query.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: 0 or an integer greater than 32 MB. The default unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S-Zy06lS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mr69h7c137hixnljbrbb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S-Zy06lS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mr69h7c137hixnljbrbb.png" alt="Image description" width="800" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;query_max_mem&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the maximum memory that can be used by a query.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: 0 or an integer greater than 32 MB. The default unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qsk1mKqy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50g3mw1rzseo0k79t9br.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qsk1mKqy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50g3mw1rzseo0k79t9br.png" alt="Image description" width="800" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;maintenance_work_mem&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the maximum amount of memory to be used by maintenance operations, such as &lt;strong&gt;VACUUM, CREATE INDEX&lt;/strong&gt;, and &lt;strong&gt;ALTER TABLE ADD FOREIGN KEY&lt;/strong&gt;. This parameter may affect the execution efficiency of &lt;strong&gt;VACUUM, VACUUM FULL, CLUSTER&lt;/strong&gt;, and &lt;strong&gt;CREATE INDEX&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 1024 to *INT*MAX_. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 16 MB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mJbSh82S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bjajtri5hbl71q9wknv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mJbSh82S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bjajtri5hbl71q9wknv.png" alt="Image description" width="800" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;psort_work_mem&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the memory capacity to be used for partial sorting in a column-store table before writing to temporary disk files. This parameter can be used for inserting tables having a partial cluster key or index, creating a table index, and deleting or updating a table.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qjNcD9SE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ho5ax72r3q518ocgefyx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qjNcD9SE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ho5ax72r3q518ocgefyx.png" alt="Image description" width="800" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 64 to 2147483647. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 512 MB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;max_loaded_cudesc&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the number of cudesc cached in each column when a column-store table is scanned. Increasing the value will improve query performance and increase memory usage, particularly when there are many columns in the column-store table.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mfm3V5wA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wdw3ow3nsb4x5nqhngl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mfm3V5wA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wdw3ow3nsb4x5nqhngl.png" alt="Image description" width="720" height="45"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: 100 to 1073741823&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 1024&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;max_stack_depth&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the maximum safe depth of the openGauss execution stack. The safety margin is required because the stack depth is not checked in every routine in the server, but only in key potentially-recursive routines, such as expression evaluation.&lt;/p&gt;

&lt;p&gt;This parameter is a SUSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 100 to *INT*MAX_. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; If the value of &lt;strong&gt;ulimit -s&lt;/strong&gt; minus 640 KB is greater than or equal to 2 MB, the default value of this parameter is &lt;strong&gt;2 MB&lt;/strong&gt;.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; If the value of &lt;strong&gt;ulimit -s&lt;/strong&gt; minus 640 KB is less than 2 MB, the default value of this parameter is the value of &lt;strong&gt;ulimit -s&lt;/strong&gt; minus 640 KB.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LekrvpVS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h6l4mwicsv51mu30wuih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LekrvpVS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h6l4mwicsv51mu30wuih.png" alt="Image description" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;cstore_buffers&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the shared buffer size used in column-store tables.&lt;/p&gt;

&lt;p&gt;This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 16384 to 1073741823. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 1 GB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting suggestions&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Column-store tables use the shared buffer specified by &lt;strong&gt;cstore_buffers&lt;/strong&gt; instead of that specified by &lt;strong&gt;shared_buffers&lt;/strong&gt;. When column-store tables are mainly used, reduce the value of &lt;strong&gt;shared_buffers&lt;/strong&gt; and increase that of &lt;strong&gt;cstore_buffers&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bulk_read_ring_size&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the size of the ring buffer used by the operation when a large amount of data is queried (for example, during large table scanning).&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 256 to 2147483647. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 16 MB&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies whether the operator memory can be released in advance.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: Boolean&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; on indicates that the operator memory can be released in advance.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; off indicates that the operator memory cannot be released in advance.&lt;br&gt;
&lt;strong&gt;Default value: on&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;local_syscache_threshold&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the size of system catalog cache in a session.&lt;/p&gt;

&lt;p&gt;This parameter is a PGC_SIGHUP parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;If &lt;strong&gt;enable_global_plancache&lt;/strong&gt; is enabled, &lt;strong&gt;local_syscache_threshold&lt;/strong&gt; does not take effect when it is set to a value less than 16 MB to ensure that GPC takes effect. The minimum value is 16 MB.&lt;/p&gt;

&lt;p&gt;If &lt;strong&gt;enable_global_syscache&lt;/strong&gt; and &lt;strong&gt;enable_thread_pool&lt;/strong&gt; are enabled, this parameter indicates the total cache size of the current thread and sessions bound to the current thread.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 1 x 1024 to 512 x 1024. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 256MB&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>Performance Tuning-Analyzing Hardware Bottlenecks-Memory（1）</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 09:02:34 +0000</pubDate>
      <link>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-memory1-16l1</link>
      <guid>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-memory1-16l1</guid>
      <description>&lt;p&gt;This section describes memory parameters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vGPvPXYv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sk18gw8ox1xclfergw30.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vGPvPXYv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sk18gw8ox1xclfergw30.png" alt="Image description" width="800" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;memorypool_enable&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies whether to enable a memory pool.&lt;/p&gt;

&lt;p&gt;This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: Boolean&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;on&lt;/strong&gt; indicates that the memory pool is enabled.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;off&lt;/strong&gt; indicates that the memory pool is disabled.&lt;br&gt;
&lt;strong&gt;Default value&lt;/strong&gt;: off&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;memorypool_size&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the memory pool size.&lt;/p&gt;

&lt;p&gt;This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 128 x 1024 to *INT*MAX_/2. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 512 MB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;enable_memory_limit&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies whether to enable the logical memory management module.&lt;/p&gt;

&lt;p&gt;This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: Boolean&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;on&lt;/strong&gt;  indicates that the logical memory management module is enabled.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;off&lt;/strong&gt; indicates that the logical memory management module is disabled.&lt;br&gt;
&lt;strong&gt;Default value: on&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9uduWWL0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jqx38j23ippk5rr31jqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9uduWWL0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jqx38j23ippk5rr31jqy.png" alt="Image description" width="800" height="184"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;max_process_memory&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the maximum physical memory of a database node.&lt;/p&gt;

&lt;p&gt;This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 2 x 1024 x 1024 to *INT*MAX_. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 12 GB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting suggestions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The value on the database node is determined based on the physical memory of the system and the number of master database nodes deployed on a single node. The recommended calculation formula is as follows: (Physical memory – vm.min_free_kbytes) \ x 0.7 /(1 + Number of primary nodes) This parameter is used to prevent node OOM caused by memory usage increase, ensuring system reliability. &lt;strong&gt;vm.min_free_kbytes&lt;/strong&gt; indicates the OS memory reserved for the kernel to receive and send data. Its value is at least 5% of the total memory. That is, max_process_memory = Physical memory x 0.665 / (1 + Number of primary nodes)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zu34SSWi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cmkncdsmfmjsy65fktbv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zu34SSWi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cmkncdsmfmjsy65fktbv.png" alt="Image description" width="800" height="57"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;enable_memory_context_control&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies whether to enable the function of checking whether the number of memory contexts exceeds the specified limit. This parameter applies only to the DEBUG version.&lt;/p&gt;

&lt;p&gt;This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: Boolean&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;· on&lt;/strong&gt; indicates that the function of checking the number of memory contexts is enabled.&lt;br&gt;
&lt;strong&gt;· off&lt;/strong&gt; indicates that the function of checking the number of memory contexts is disabled.&lt;br&gt;
&lt;strong&gt;Default value: off&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;uncontrolled_memory_context&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies which memory texts will not be checked when the &lt;strong&gt;enable_memory_context_control&lt;/strong&gt; parameter is set to on. This parameter applies only to the DEBUG version.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;During the query, the title meaning string “MemoryContext white list:” is added to the beginning of the parameter value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: a string&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: empty&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;shared_buffers&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the size of shared memory used by openGauss. Increasing the value of this parameter causes openGauss to request more System V shared memory than the default configuration allows.&lt;/p&gt;

&lt;p&gt;This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 16 to 1073741823. The unit is 8 KB.&lt;/p&gt;

&lt;p&gt;The value of &lt;strong&gt;shared_buffers&lt;/strong&gt; must be an integer multiple of &lt;strong&gt;BLCKSZ&lt;/strong&gt;. &lt;strong&gt;Currently&lt;/strong&gt;, &lt;strong&gt;BLCKSZ&lt;/strong&gt; is set to &lt;strong&gt;8 KB&lt;/strong&gt;. That is, the value of &lt;strong&gt;shared_buffers&lt;/strong&gt; must be an integer multiple of 8 KB. The minimum value changes according to &lt;strong&gt;BLCKSZ&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 8 MB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting suggestions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Set &lt;strong&gt;shared_buffers&lt;/strong&gt; to a value less than 40% of the memory. Set it to a large value for row-store tables and a small value for column-store tables. For column-store tables: &lt;strong&gt;shared_buffers&lt;/strong&gt; = (Memory of a single server/Number of database nodes on the server) x 0.4 x 0.25&lt;/p&gt;

&lt;p&gt;If &lt;strong&gt;shared_buffers&lt;/strong&gt; is set to a larger value, increase the value of &lt;strong&gt;checkpoint_segments&lt;/strong&gt; because a longer period of time is required to write a large amount of new or changed data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;segment_buffers&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the memory size of an openGauss segment-paged metadata page.&lt;/p&gt;

&lt;p&gt;This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 16 to 1073741823. The unit is 8 KB.&lt;/p&gt;

&lt;p&gt;The value of segment_buffers_buffers** must be an integer multiple of BLCKSZ. Currently, BLCKSZ is set to 8 KB. That is, the value of segment_buffers must be an integer multiple of 8 KB. The minimum value changes according to the value of BLCKSZ.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value&lt;/strong&gt;: 8 MB&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting suggestions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;segment_buffers&lt;/strong&gt; is used to cache the content of segment-paged headers, which is key metadata information. To improve performance, it is recommended that the segment headers of common tables be cached in the buffer and not be replaced. You are advised to set this parameter based on the following formula: Number of tables (including indexes and toast tables) x Number of partitions x 3 &lt;strong&gt;+ 128&lt;/strong&gt;. This is because each table (partition) has some extra metadata segments. Generally, a table has three segments. At last, + 128 is added because segment- and page-based tablespace management requires a certain number of buffers.&lt;/p&gt;

&lt;p&gt;If this parameter is set to a small value, it takes a long time to create a segment-paged table for the first time. Therefore, you are advised to set this parameter to the recommended value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bulk_write_ring_size&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the size of the ring buffer used by the operation when a large amount of data is written (for example, the copy operation).&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 16384 to 2147483647. The unit is KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 2 GB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting suggestions&lt;/strong&gt;: Increase the value of this parameter on database nodes if a huge amount of data will be imported.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;standby_shared_buffers_fraction&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the &lt;strong&gt;shared_buffers&lt;/strong&gt; proportion used on the server where a standby instance is deployed.&lt;/p&gt;

&lt;p&gt;This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: a double-precision floating-point number ranging from 0.1 to 1.0&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value&lt;/strong&gt;: 0.3&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;temp_buffers&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Parameter description&lt;/strong&gt;: Specifies the maximum size of local temporary buffers used by a database session.&lt;/p&gt;

&lt;p&gt;This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;temp_buffers&lt;/strong&gt; can be modified only before the first use of temporary tables within each session. Subsequent attempts to change the value of this parameter will not take effect on that session.&lt;/p&gt;

&lt;p&gt;A session allocates temporary buffers based on the value of &lt;strong&gt;temp_buffers&lt;/strong&gt;. If a large value is set in a session that does not require many temporary buffers, only the overhead of one buffer descriptor is added. If a buffer is used, additional 8192 bytes will be consumed for it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value range&lt;/strong&gt;: an integer ranging from 100 to 1073741823. The unit is 8 KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default value: 1 MB&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>Performance Tuning-Analyzing Hardware Bottlenecks-CPU</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 08:02:50 +0000</pubDate>
      <link>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-cpu-2ppj</link>
      <guid>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-cpu-2ppj</guid>
      <description>&lt;p&gt;You can run the top command to check the CPU usage of each node in openGauss and analyze whether performance bottleneck caused by heavy CPU load exists. The &lt;strong&gt;top&lt;/strong&gt; command is used to monitor the Linux OS status. It is a common performance analysis tool and can display the resource usage of each process in the system in real time.&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;-d&lt;/strong&gt;: number of seconds, indicating the interval for updating the page displayed by running the &lt;strong&gt;top&lt;/strong&gt; command. The default value is 5 seconds.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;-b&lt;/strong&gt;: executes the &lt;strong&gt;top&lt;/strong&gt; command in batches.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;-n&lt;/strong&gt;: This parameter is used together with &lt;strong&gt;-b&lt;/strong&gt; to indicate the number of times that the &lt;strong&gt;top&lt;/strong&gt; command is executed.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; &lt;strong&gt;-p&lt;/strong&gt;: specifies a PID for observation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checking CPU Usage&lt;/strong&gt;&lt;br&gt;
You can query the CPU usage of the server in the following ways:&lt;/p&gt;

&lt;p&gt;On each storage node, run the &lt;strong&gt;top&lt;/strong&gt; command to check the CPU usage. Then, press &lt;strong&gt;1&lt;/strong&gt; to view the usage of each CPU core.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K7DGeh0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yl9aodvkc2jnjht5qvhi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K7DGeh0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yl9aodvkc2jnjht5qvhi.png" alt="Image description" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the command output, focus on the CPU usage occupied by each process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;us&lt;/strong&gt; indicates the CPU percentage occupied by the user space, &lt;strong&gt;sy&lt;/strong&gt; indicates the CPU percentage occupied by the kernel space, and &lt;strong&gt;id&lt;/strong&gt; indicates the idle CPU percentage. If &lt;strong&gt;id&lt;/strong&gt; is less than 10%, the CPU load is high. In this case, you can reduce the CPU load by reducing the number of tasks on nodes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analyzing Performance Parameters&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run the top-H command to check the CPU usage. The following is displayed:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dpWIXe5r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ks3k7upcijsoq7kpuwh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dpWIXe5r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ks3k7upcijsoq7kpuwh.png" alt="Image description" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the query result for Cpu(s), check whether the system CPU (sy) or user CPU (us) usage is high.
2.1 If the system CPU usage is too high, you need to identify the abnormal system processes and handle them.
2.2 If the CPU usage of the openGauss process whose &lt;strong&gt;USER&lt;/strong&gt; is &lt;strong&gt;omm&lt;/strong&gt; is too high, optimize the service-related SQL statements based on the running services queries. Based on the features of the currently running service, perform the following operations to check whether this process containing infinite loop logics.
2.1.1 Run the **top -H -p pid **command to identify the threads that use much CPU in the process.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s5lYGflc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/937epd1ki6d1i6e24ysv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s5lYGflc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/937epd1ki6d1i6e24ysv.png" alt="Image description" width="220" height="41"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The threads causing high CPU usage are displayed in the &lt;strong&gt;top&lt;/strong&gt; column of the command output. In this section, thread &lt;strong&gt;54775&lt;/strong&gt; is used as an example for analyzing the causes of the high CPU usage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hW7he9ls--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3q8e78rwiucviwhi81r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hW7he9ls--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3q8e78rwiucviwhi81r.png" alt="Image description" width="761" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.2.2 Run the following command to view the function invocation stack for each thread in the process. Check the thread number for the ID of the thread that occupies high CPU usage in the last step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SHDQmM7H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1u9glsd1gcn46v43xlz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SHDQmM7H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1u9glsd1gcn46v43xlz.png" alt="Image description" width="149" height="33"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The query result is as follows. The thread number for the thread ID &lt;strong&gt;54775&lt;/strong&gt; is &lt;strong&gt;10&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jWVoplht--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rsohst1me5ex2f6z5hmp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jWVoplht--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rsohst1me5ex2f6z5hmp.png" alt="Image description" width="774" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>Performance Tuning-Analyzing Hardware Bottlenecks</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 07:31:38 +0000</pubDate>
      <link>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-i6f</link>
      <guid>https://dev.to/llxq2023/performance-tuning-analyzing-hardware-bottlenecks-i6f</guid>
      <description>&lt;p&gt;The CPU, memory, I/O, and network resource usage of each node in openGauss are obtained to check whether these resources are fully used and whether any bottleneck exists.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; CPU&lt;br&gt;
You can run the top command to check the CPU usage of each node in openGauss and analyze whether performance bottleneck caused by heavy CPU load exists.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; Memory&lt;br&gt;
Run the top command to check the memory usage of each node in openGauss and analyze whether a performance bottleneck occurs due to high memory usage.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; I/O&lt;br&gt;
You can run the iostat or pidstat command, or use openGauss heath check tools to check the I/O usage and throughput on each node in openGauss and analyze whether performance bottleneck caused by I/O exists.&lt;br&gt;
&lt;strong&gt;·&lt;/strong&gt; Network&lt;br&gt;
You can run the sar or ifconfig command to check the network status on each node in openGauss and analyze whether performance bottlenecks caused by network faults occur.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>Performance Tuning-Determining the Scope of Performance Tuning</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 07:29:57 +0000</pubDate>
      <link>https://dev.to/llxq2023/performance-tuning-determining-the-scope-of-performance-tuning-10nd</link>
      <guid>https://dev.to/llxq2023/performance-tuning-determining-the-scope-of-performance-tuning-10nd</guid>
      <description>&lt;p&gt;Database performance tuning often happens when users are not satisfied with the service execution efficiency and want to improve the efficiency. The database performance is affected by many factors as described in section Performance Elements. Therefore, performance tuning is a complex process and sometimes cannot be systematically described or explained. It depends more on the database administrator's experience. However, this section still attempts to illustrate the performance tuning methods that can be referred to by application development personnel and new openGauss database administrators.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance Elements&lt;/strong&gt;&lt;br&gt;
There are multiple performance factors that affect the database performance. Knowing these factors can help you identify and analyze performance-associated issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; System resources&lt;/p&gt;

&lt;p&gt;Database performance greatly relies on disk I/O and memory usage. To accurately set performance counters, you need to have a knowledge of the basic performance of the hardware deployed in openGauss. Performance of hardware, such as the CPU, hard disk, disk controller, memory, and network interfaces, greatly affects database running speed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Load&lt;/p&gt;

&lt;p&gt;The load indicates the total database system demands and it changes over time. The overall load contains user queries, applications, concurrent jobs, transactions, and system commands transferred at any time. For example, the system load increases if multiple users are executing multiple queries. The load will significantly affect the database performance. Identifying load peak hours helps improve resource utilization so that tasks are executed effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Throughput&lt;/p&gt;

&lt;p&gt;The data processing capability of a database is defined by its throughput. Database throughput is measured by the number of queries or processed transactions per second or by the average response time. The database processing capacity is closely related to the underlying system performance (disk I/O, CPU speed, and storage bandwidth). You need to know about the hardware performance before setting a target throughput.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Competition&lt;/p&gt;

&lt;p&gt;Competition indicates that two or more load components try to use system resources in a conflicting way. For example, competition occurs when multiple queries attempt to update the same data at the same time, or when a large number of loads compete for system resources. When competition increases, the throughput decreases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Optimization&lt;/p&gt;

&lt;p&gt;The database optimization can affect the performance of the whole system. Before executing the SQL statements, configuring database parameters, designing tables, and performing data distribution, enable the database query optimizer can help you obtain the most efficient execution plan.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Determining the Tuning Scope&lt;/strong&gt;&lt;br&gt;
Performance tuning depends on the usage of hardware resources, such as the CPU, memory, I/O, and network of each node in openGauss. Check whether these resources are fully utilized, and whether any bottlenecks exist, and then perform performance tuning as required.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; If a resource reaches the bottleneck:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check whether the key OS parameters and database parameters are properly set and perform System Optimization.&lt;/li&gt;
&lt;li&gt;Find the resource consuming SQL statements by querying the most time-consuming SQL statements and unresponsive SQL statements, and then perform SQL Optimization.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; If no resource reaches the bottleneck, the system performance can be improved. In this case, query the most time-consuming SQL statements and the unresponsive SQL statements, and then perform SQL Optimization as required.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Analyzing Hardware Bottlenecks&lt;br&gt;
The CPU, memory, I/O, and network resource usage of each node in openGauss are obtained to check whether these resources are fully used and whether any bottleneck exists.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Querying SQL Statements That Affect Performance Most&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;·&lt;/strong&gt; Checking Blocked Statements&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>Performance Tuning-Overview</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 07:24:14 +0000</pubDate>
      <link>https://dev.to/llxq2023/performance-tuning-overview-26d2</link>
      <guid>https://dev.to/llxq2023/performance-tuning-overview-26d2</guid>
      <description>&lt;p&gt;To fine-tune openGauss performance, you need to identify performance bottlenecks, adjust key parameters, and optimize SQL statements. During performance tuning, locate and analyze performance issues based on performance elements, such as system resources, throughput, and loads to achieve required system performance.&lt;/p&gt;

&lt;p&gt;Various factors must be considered during openGauss performance tuning. Therefore, optimization personnel must know well about knowledge, such as system software architecture, hardware and software configuration, database parameter configuration, concurrency control, query processing, and database applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hgPnRBjV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8r55arqzuvzhd2az9l2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hgPnRBjV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8r55arqzuvzhd2az9l2f.png" alt="Image description" width="800" height="108"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tuning Process&lt;/strong&gt;&lt;br&gt;
Figure 1 shows the procedure of performance tuning.&lt;/p&gt;

&lt;p&gt;Figure 1 openGauss performance tuning&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PC65yxgN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvim2w2j9tqh30mdjy8u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PC65yxgN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvim2w2j9tqh30mdjy8u.png" alt="Image description" width="800" height="729"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Table 1 lists the details about each phase.&lt;/p&gt;

&lt;p&gt;Table 1 openGauss performance tuning&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PXknQcSE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5qj2czn6a1wcma9my03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PXknQcSE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5qj2czn6a1wcma9my03.png" alt="Image description" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>Comparison – Disk vs. MOT</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 07:21:38 +0000</pubDate>
      <link>https://dev.to/llxq2023/comparison-disk-vs-mot-42oa</link>
      <guid>https://dev.to/llxq2023/comparison-disk-vs-mot-42oa</guid>
      <description>&lt;p&gt;The following table briefly compares the various features of the openGauss disk-based storage engine and the MOT storage engine.&lt;/p&gt;

&lt;p&gt;Table 1 Comparison – Disk-based vs. MOT&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KR8H1Khi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfz8jhmychmsxlrkkrvo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KR8H1Khi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfz8jhmychmsxlrkkrvo.png" alt="Image description" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Appendices&lt;br&gt;
References&lt;/strong&gt;&lt;br&gt;
[1] Y. Mao, E. Kohler, and R. T. Morris. Cache craftiness for fast multicore key-value storage. In Proc. 7th ACM European Conference on Computer Systems (EuroSys), Apr. 2012.&lt;/p&gt;

&lt;p&gt;[2] K. Ren, T. Diamond, D. J. Abadi, and A. Thomson. Low-overhead asynchronous checkpointing in main-memory database systems. In Proceedings of the 2016 ACM SIGMOD International Conference on Management of Data, 2016.&lt;/p&gt;

&lt;p&gt;[3] Tu, S., Zheng, W., Kohler, E., Liskov, B., and Madden, S. Speedy transactions in multicore in-memory databases. In Proceedings of the Twenty-Fourth ACM Symposium on Operating Systems Principles (New York, NY, USA, 2013), SOSP ’13, ACM, pp. 18–32.&lt;/p&gt;

&lt;p&gt;[4] H. Avni at al. Industrial-Strength OLTP Using Main Memory and Many-cores, VLDB 2020.&lt;/p&gt;

&lt;p&gt;[5] Bernstein, P. A., and Goodman, N. Concurrency control in distributed database systems. ACM Comput. Surv. 13, 2 (1981), 185–221.&lt;/p&gt;

&lt;p&gt;[6] Felber, P., Fetzer, C., and Riegel, T. Dynamic performance tuning of word-based software transactional memory. In Proceedings of the 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPOPP 2008, Salt Lake City, UT, USA, February 20-23, 2008 (2008),&lt;/p&gt;

&lt;p&gt;pp. 237–246.&lt;/p&gt;

&lt;p&gt;7] Appuswamy, R., Anadiotis, A., Porobic, D., Iman, M., and Ailamaki, A. Analyzing the impact of system architecture on the scalability of OLTP engines for high-contention workloads. PVLDB 11, 2 (2017),&lt;/p&gt;

&lt;p&gt;121–134.&lt;/p&gt;

&lt;p&gt;[8] R. Sherkat, C. Florendo, M. Andrei, R. Blanco, A. Dragusanu, A. Pathak, P. Khadilkar, N. Kulkarni, C. Lemke, S. Seifert, S. Iyer, S. Gottapu, R. Schulze, C. Gottipati, N. Basak, Y. Wang, V. Kandiyanallur, S. Pendap, D. Gala, R. Almeida, and P. Ghosh. Native store extension for SAP HANA. PVLDB, 12(12):&lt;/p&gt;

&lt;p&gt;2047–2058, 2019.&lt;/p&gt;

&lt;p&gt;[9] X. Yu, A. Pavlo, D. Sanchez, and S. Devadas. Tictoc: Time traveling optimistic concurrency control. In Proceedings of the 2016 International Conference on Management of Data, SIGMOD Conference 2016, San Francisco, CA, USA, June 26 - July 01, 2016, pages 1629–1642, 2016.&lt;/p&gt;

&lt;p&gt;[10] V. Leis, A. Kemper, and T. Neumann. The adaptive radix tree: Artful indexing for main-memory databases. In C. S. Jensen, C. M. Jermaine, and X. Zhou, editors, 29th IEEE International Conference on Data Engineering, ICDE 2013, Brisbane, Australia, April 8-12, 2013, pages 38–49. IEEE Computer Society, 2013.&lt;/p&gt;

&lt;p&gt;[11] S. K. Cha, S. Hwang, K. Kim, and K. Kwon. Cache-conscious concurrency control of main-memory indexes on shared-memory multiprocessor systems. In P. M. G. Apers, P. Atzeni, S. Ceri, S. Paraboschi, K. Ramamohanarao, and R. T. Snodgrass, editors, VLDB 2001, Proceedings of 27th International Conference on Very Large Data Bases, September 11-14, 2001, Roma, Italy, pages 181–190. Morga Kaufmann, 2001.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Glossary&lt;/strong&gt;&lt;br&gt;
Table 2 Glossary&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--toIkDErt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/se6s7srrgytpznrr98kd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--toIkDErt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/se6s7srrgytpznrr98kd.png" alt="Image description" width="800" height="729"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MtvqFlU6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbag2ddimyjnaef57e95.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MtvqFlU6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbag2ddimyjnaef57e95.png" alt="Image description" width="800" height="746"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FVi8Ye3R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/epizxadvle8ulmg7u2ph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FVi8Ye3R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/epizxadvle8ulmg7u2ph.png" alt="Image description" width="800" height="743"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I1PN6JkY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5hd49d8ulj3voolgj3l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I1PN6JkY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5hd49d8ulj3voolgj3l.png" alt="Image description" width="800" height="588"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>MOT JIT Diagnostics</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 06:22:54 +0000</pubDate>
      <link>https://dev.to/llxq2023/mot-jit-diagnostics-54b2</link>
      <guid>https://dev.to/llxq2023/mot-jit-diagnostics-54b2</guid>
      <description>&lt;p&gt;&lt;strong&gt;mot_jit_detail&lt;/strong&gt;&lt;br&gt;
This built-in function is used to query the details about JIT compilation (code generation).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usage Examples&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3ujMqbhY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jeobg9y9104nt8bo06po.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3ujMqbhY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jeobg9y9104nt8bo06po.png" alt="Image description" width="800" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output Description&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ucZmt0JP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5u5prx9h2cqs6q7p7k2n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ucZmt0JP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5u5prx9h2cqs6q7p7k2n.png" alt="Image description" width="800" height="612"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;mot_jit_profile&lt;/strong&gt;&lt;br&gt;
This built-in function is used to query the profiling data (performance data) of the query or stored procedure execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usage Examples&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9QduPwum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4rkt6tu29rs7xx8o9iw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9QduPwum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4rkt6tu29rs7xx8o9iw2.png" alt="Image description" width="800" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output Description&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m7MD2-6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zh01y16659ud5lwv0xxw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m7MD2-6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zh01y16659ud5lwv0xxw.png" alt="Image description" width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Miscellaneous&lt;/strong&gt;&lt;br&gt;
Another useful system table to get information about stored procedures and functions is &lt;strong&gt;pg_proc&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, body of a stored procedure can be queried using the following query:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UkAgor2H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mu6onteeuege6ul07lui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UkAgor2H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mu6onteeuege6ul07lui.png" alt="Image description" width="761" height="37"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>MOT Query Native Compilation (JIT)</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 04:52:02 +0000</pubDate>
      <link>https://dev.to/llxq2023/mot-query-native-compilation-jit-39m2</link>
      <guid>https://dev.to/llxq2023/mot-query-native-compilation-jit-39m2</guid>
      <description>&lt;p&gt;Native Compilation (JIT) is one of key technologies of MOT for delivering exceptionally low latency and high throughput performance. Two types of Native Compilation (JIT) are supported (using a PREPARE statement): 1) JIT for Stored Procedures (JIT SP), and 2) JIT for Queries (JIT Query). The following sections describe how to use both mechanisms in your application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JIT SP&lt;/strong&gt;&lt;br&gt;
JIT SP refers to code generation, compiling and execution of stored procedures (SP) by LLVM runtime code generation and compilation library. JIT SP is available to SPs accessing MOT tables (only) and is completely transparent to users. Acceleration level depends on the SP logic. For example, a real customer application achieved acceleration of 20%, 44%, 300% and 500% for different SPs in latency. During the PREPARE phase of a query invoking an SP, or the first SP execution, the JIT module performs an attempt to translate the SP SQL into a C-based function and compile it in runtime (using LLVM). If the consecutive SP invocation is successful, MOT will execute a compiled function, leading to performance gains. In case of failure to produce a compiled function, the SP will be executed by standard PGPLSQL. Both scenarios are fully transparent to users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JIT Query&lt;/strong&gt;&lt;br&gt;
MOT enables you to prepare and parse pre-compiled full queries in a native format (using a &lt;strong&gt;PREPARE&lt;/strong&gt; statement) before they are needed for execution.&lt;/p&gt;

&lt;p&gt;This native format can later be executed (using an &lt;strong&gt;EXECUTE&lt;/strong&gt; command) more efficiently. This type of execution is much more efficient because during execution the native format bypasses multiple database processing layers. This division of labor avoids repetitive parse analysis operations. The Lite Executor module is responsible for executing &lt;strong&gt;prepared&lt;/strong&gt; queries and has a much faster execution path than the regular generic plan performed by the envelope. This is achieved using Just-In-Time (JIT) compilation via LLVM. In addition, a similar solution that has potentially similar performance is provided in the form of pseudo-LLVM.&lt;/p&gt;

&lt;p&gt;The following is an example of a &lt;strong&gt;PREPARE&lt;/strong&gt; syntax in SQL –&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o-0jrxxI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5yj3z9lcq2f8uvh9v98e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o-0jrxxI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5yj3z9lcq2f8uvh9v98e.png" alt="Image description" width="611" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following is an example of how to invoke a PREPARE and then an EXECUTE statement in a Java application –&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V7Lb6fFO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5njh3s3zrrkzmo0hk5eb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V7Lb6fFO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5njh3s3zrrkzmo0hk5eb.png" alt="Image description" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prepare&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;PREPARE&lt;/strong&gt; creates a prepared statement. A prepared statement is a server-side object that can be used to optimize performance. When the &lt;strong&gt;PREPARE&lt;/strong&gt; statement is executed, the specified statement is parsed, analyzed and rewritten.&lt;/p&gt;

&lt;p&gt;If the tables mentioned in the query statement are MOT tables, the MOT compilation takes charge of the object preparation and performs a special optimization by compiling the query into IR byte code based on LLVM.&lt;/p&gt;

&lt;p&gt;Whenever a new query compilation is required, the query is analyzed and a proper tailored IR byte code is generated for the query using the utility GsCodeGen object and standard LLVM JIT API (IRBuilder). After byte-code generation is completed, the code is JIT‑compiled into a separate LLVM module. The compiled code results in a C function pointer that can later be invoked for direct execution. Note that this C function can be invoked concurrently by many threads, as long as each thread provides a distinct execution context (details are provided below). Each such execution context is referred to as JIT Context.&lt;/p&gt;

&lt;p&gt;To improve performance further, MOT JIT applies a caching policy for its LLVM code results, enabling them to be reused for the same queries across different sessions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Execute&lt;/strong&gt;&lt;br&gt;
When an EXECUTE command is issued, the prepared statement (described above) is planned and executed. This division of labor avoids repetitive parse analysis work, while enabling the execution plan to depend on the specific setting values supplied.&lt;/p&gt;

&lt;p&gt;When the resulting execute query command reaches the database, it uses the corresponding IR byte code which is executed directly and more efficiently within the MOT engine. This is referred to as Lite Execution.&lt;/p&gt;

&lt;p&gt;In addition, for availability, the Lite Executor maintains a preallocated pool of JIT sources. Each session preallocates its own session-local pool of JIT context objects (used for repeated executions of precompiled queries).&lt;/p&gt;

&lt;p&gt;You may refer to the Unsupported JIT features section in MOT SQL Coverage and Limitations page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JIT for Stored procedures&lt;/strong&gt;&lt;br&gt;
JIT for Stored Procedures (JIT SP) is supported by the openGauss MOT engine (starting from 5.0 version), and its goal is deliver even higher performance and lower latency. Refer to&lt;a href="https://dev.toJIT%20for%20Stored%20procedures"&gt; JIT for SP&lt;/a&gt; for more details.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>MOT Recovery Concepts</title>
      <dc:creator>Qing</dc:creator>
      <pubDate>Mon, 24 Apr 2023 04:48:27 +0000</pubDate>
      <link>https://dev.to/llxq2023/mot-recovery-concepts-cgb</link>
      <guid>https://dev.to/llxq2023/mot-recovery-concepts-cgb</guid>
      <description>&lt;p&gt;The MOT Recovery Module provides all the required functionality for recovering the MOT tables data. The main objective of the Recovery module is to restore the data and the MOT engine to a consistent state after a planned (maintenance for example) shut down or an unplanned (power failure for example) crash.&lt;/p&gt;

&lt;p&gt;openGauss database recovery, which is also sometimes called a Cold Start, includes MOT tables and is performed automatically with the recovery of the rest of the database. The MOT Recovery Module is seamlessly and fully integrated into the openGauss recovery process.&lt;/p&gt;

&lt;p&gt;MOT recovery has two main stages – Checkpoint Recovery and WAL Recovery (Redo Log).&lt;/p&gt;

&lt;p&gt;MOT checkpoint recovery is performed before the envelope's WAL recovery takes place. This is done only at cold-start events (start server). It recovers the metadata first (schema) and then inserts all the rows from the current valid checkpoint, which is done in parallel by checkpoint_recovery_workers, each working on a different table. The indexes are created during the insert process.&lt;/p&gt;

&lt;p&gt;When checkpointing a table, it is divided into 16 MB chunks, so that multiple recovery workers can recover the table in parallel. This is done in order to speed-up the checkpoint recovery, it is implemented as a multi-threaded procedure where each thread is responsible for recovering a different segment. There are no dependencies between different segments therefore there is no contention between the threads and there is no need to use locks when updating table or inserting new rows.&lt;/p&gt;

&lt;p&gt;WAL records are recovered as part of the envelope's WAL recovery. openGauss envelope iterates through the XLOG and performs the necessary operation based on the xlog record type. In case of entry with record type MOT, the envelope forwards it to MOT RecoveryManager for handling. The xlog entry will be ignored by MOT recovery, if it is 'too old' – its LSN is older than the checkpoint's LSN (Log Sequence Number).&lt;/p&gt;

&lt;p&gt;Performance is the key benefit of MOT, and low latency RTO in high availability scenarios is not an exception. With openGauss 5.0 release, MOT engine includes a Parallel Recovery mechanism to achieve low RTO as per openGauss specifications.&lt;/p&gt;

&lt;p&gt;In an active-standby deployment, the standby server is always in a Recovery state for an automatic WAL recovery process.&lt;/p&gt;

&lt;p&gt;The MOT recovery parameters are set in the mot.conf file explained in the MOT Recovery section.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
  </channel>
</rss>
