Updated on 2022-07-29 GMT+08:00

PGXC_SQL_COUNT

PGXC_SQL_COUNT displays the node-level and user-level statistics for the SQL statements of SELECT, INSERT, UPDATE, DELETE, and MERGE INTO and DDL, DML, and DCL statements of each CN in a cluster in real time, identifies query types with heavy load, and measures the capability of a cluster or a node to perform a specific type of query. You can calculate QPS based on the quantities and response time of the preceding types of SQL statements at certain time points. For example, USER1 SELECT is counted as X1 at T1 and as X2 at T2. The SELECT QPS of the user can be calculated as follows: (X2 – X1)/(T2 – T1). In this way, the system can draw cluster-user-level QPS curve graphs and determine cluster throughput, monitoring changes in the service load of each user. If there are drastic changes, the system can locate the specific statement type (such as SELECT, INSERT, UPDATE, DELETE, and MERGE INTO). You can also observe QPS curves to determine the time points when problems occur and then locate the problems using other tools. The curves provide a basis for optimizing cluster performance and locating problems.

Columns in the PGXC_SQL_COUNT view are the same as those in the GS_SQL_COUNT view. For details, see Table 1.

If a MERGE INTO statement can be pushed down and a DN receives it, the statement will be counted on the DN and the value of the mergeinto_count column will increment by 1. If the pushdown is not allowed, the DN will receive an UPDATE or INSERT statement. In this case, the update_count or insert_count column will increment by 1.