Overview
The CDB_WR_SQLSTAT view displays basic performance statistics for all SQL statements executed by tenants. Each SQL statement is represented as a row (i.e., each unique combination of SQL_ID and Plan_Hash corresponds to one row). A column containing _DELTA indicates the incremental value of the statistic from the time the last WR snapshot was collected until the current time.
Columns
Field |
Type |
Nullable |
Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | Tenant ID |
| SNAP_ID | bigint(20) | NO | Snapshot ID |
| SVR_IP | varchar(46) | NO | Node IP |
| SVR_PORT | bigint(20) | NO | Node Port Number |
| SQL_ID | varchar(32) | NO | SQL Statement ID |
| PLAN_HASH | bigint(20) unsigned | NO | Hash value of the execution plan |
| PLAN_ID | bigint(20) | NO | Execution Plan ID |
| PLAN_TYPE | bigint(20) | NO | For SQL plan caching, this field indicates the plan type:
For PL object caching, this field indicates the type of the PL object:
|
| MODULE | varchar(64) | YES | The application module when the statement was parsed for the first time. |
| ACTION | varchar(64) | YES | Application action when the statement is parsed for the first time |
| PARSING_DB_ID | bigint(20) | NO | Database ID during statement parsing |
| PARSING_DB_NAME | varchar(128) | NO | Database name during statement parsing |
| PARSING_USER_ID | bigint(20) | NO | User ID during statement parsing |
| EXECUTIONS_TOTAL | bigint(20) | NO | Total number of executions for the plan in the plan cache |
| EXECUTIONS_DELTA | bigint(20) | NO | Increment of Total Executions for the Plan in Plan Cache |
| DISK_READS_TOTAL | bigint(20) | NO | Total Disk Reads |
| DISK_READS_DELTA | bigint(20) | NO | Increment of Disk Read Operations |
| BUFFER_GETS_TOTAL | bigint(20) | NO | Total Logical Reads from Cache |
| BUFFER_GETS_DELTA | bigint(20) | NO | Increment of Logical Reads from Cache |
| ELAPSED_TIME_TOTAL | bigint(20) | NO | The total time consumed by this statement. For parallel execution scenarios, this value is the cumulative value for each execution thread. |
| ELAPSED_TIME_DELTA | bigint(20) | NO | The increment of time consumed by this statement |
| CPU_TIME_TOTAL | bigint(20) | NO | Total CPU Time |
| CPU_TIME_DELTA | bigint(20) | NO | Increment of Total CPU Time |
| CCWAIT_TOTAL | bigint(20) | NO | Total Time Spent on Concurrency-Waiting Events |
| CCWAIT_DELTA | bigint(20) | NO | Incremental Total Time Spent on Concurrency-Waiting Events |
| USERIO_WAIT_TOTAL | bigint(20) | NO | Total I/O Wait Time |
| USERIO_WAIT_DELTA | bigint(20) | NO | Incremental Total I/O Wait Time |
| APWAIT_TOTAL | bigint(20) | NO | Total Time Spent by Application-Waiting Events |
| APWAIT_DELTA | bigint(20) | NO | Incremental Total Waiting Time for Application Events |
| PHYSICAL_READ_REQUESTS_TOTAL | bigint(20) | NO | Total Number of Physical Read Requests |
| PHYSICAL_READ_REQUESTS_DELTA | bigint(20) | NO | Increment of Physical Read Requests |
| PHYSICAL_READ_BYTES_TOTAL | bigint(20) | NO | Total Bytes of Physical Reads |
| PHYSICAL_READ_BYTES_DELTA | bigint(20) | NO | Increment of Physical Read Bytes |
| WRITE_THROTTLE_TOTAL | bigint(20) | NO | Total Time Limited When Writing to MemStore |
| WRITE_THROTTLE_DELTA | bigint(20) | NO | Increment of Total Time Throttled When Writing to MemStore |
| ROWS_PROCESSED_TOTAL | bigint(20) | NO | Total rows processed |
| ROWS_PROCESSED_DELTA | bigint(20) | NO | Incremental total number of rows processed by statements |
| MEMSTORE_READ_ROWS_TOTAL | bigint(20) | NO | Total rows read from the MemStore |
| MEMSTORE_READ_ROWS_DELTA | bigint(20) | NO | Increment of Total Rows Read from MemStore |
| MINOR_SSSTORE_READ_ROWS_TOTAL | bigint(20) | NO | Total rows read from MINOR SSStore |
| MINOR_SSSTORE_READ_ROWS_DELTA | bigint(20) | NO | Increment of Total Rows Read from MINOR SSStore |
| MAJOR_SSSTORE_READ_ROWS_TOTAL | bigint(20) | NO | Total rows read from MAJOR SSStore |
| MAJOR_SSSTORE_READ_ROWS_DELTA | bigint(20) | NO | Increment of Total Rows Read from MAJOR SSStore |
| RPC_TOTAL | bigint(20) | NO | Total RPC Calls |
| RPC_DELTA | bigint(20) | NO | Increment of RPC Calls |
| FETCHES_TOTAL | bigint(20) | NO | Total Number of Result Sets Retrieved |
| FETCHES_DELTA | bigint(20) | NO | Increment of the Number of Result Sets Retrieved |
| RETRY_TOTAL | bigint(20) | NO | Total Number of SQL Retry Attempts |
| RETRY_DELTA | bigint(20) | NO | Increment of SQL Retry Count |
| PARTITION_TOTAL | bigint(20) | NO | Total Number of Partitions Scanned During SQL Execution |
| PARTITION_DELTA | bigint(20) | NO | Incremental Number of Scanned Partitions During SQL Execution |
| NESTED_SQL_TOTAL | bigint(20) | NO | Total number of nested SQL executions. The value increases by 1 for each additional executed sub-SQL statement. |
| NESTED_SQL_DELTA | bigint(20) | NO | Increment of Nested SQL Execution |
| SOURCE_IP | varchar(46) | NO | IP Address of Request Source |
| SOURCE_PORT | bigint(20) | NO | Port number of the request source |
| ROUTE_MISS_TOTAL | bigint(20) | NO | Total Number of Requests That Have Not Hit the Request Partition Since the OBServer Started |
| ROUTE_MISS_DELTA | bigint(20) | NO | Number of Requests That Did Not Hit the Partition Since the Last WR Snapshot Collection |
| FIRST_LOAD_TIME | timestamp(6) | YES | Plan generation time |
| PLAN_CACHE_HIT_TOTAL | bigint(20) | NO | Total Number of Hits in the Plan Cache Since OBServer Started |
| PLAN_CACHE_HIT_DELTA | bigint(20) | NO | Number of Times a Plan Cache Hit Occurred Since the Last WR Snapshot Collection |
| MUTI_QUERY_TOTAL | bigint(20) | NO | Number of Times the SQL Statement Has Been Included in a Multi-Query Since the Execution Plan Was Generated |
| MUTI_QUERY_DELTA | bigint(20) | NO | Number of Times This SQL Statement Has Been Included in Multi-Query Requests Since the Last WR Snapshot Collection |
| MUTI_QUERY_BATCH_TOTAL | bigint(20) | NO | Number of times the SQL batch has been executed since the plan was generated |
| MUTI_QUERY_BATCH_DELTA | bigint(20) | NO | Number of Times This SQL Batch Has Been Executed Since the Last WR Snapshot Collection |
| FULL_TABLE_SCAN_TOTAL | bigint(20) | NO | Number of Full Table Scans for This SQL Statement Since the Plan was Generated |
| FULL_TABLE_SCAN_DELTA | bigint(20) | NO | Number of Full-Table Scans of This SQL Statement Since the Last WR Snapshot Collection |
| ERROR_COUNT_TOTAL | bigint(20) | NO | Number of Times This SQL Statement Has Returned an Error Since the Plan Was Generated |
| ERROR_COUNT_DELTA | bigint(20) | NO | Number of Times This SQL Statement Has Reported Errors Since the Last WR Snapshot Collection |
| SAMPLE_TIME | timestamp(6) | NO | The time when the SQLSTAT snapshot was persisted to disk. Within an interval between two WR snapshots, SQLSTAT may be persisted to disk multiple times. |
| LATEST_ACTIVE_TIME | timestamp(6) | YES | Last Active Time of the Plan Corresponding to the SQL ID + Plan Hash on a Node |
Sample query
Query the basic performance statistics of all tenants' executed SQL statements and display the first record.
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_WR_SQLSTAT LIMIT 1\G
The query result is as follows:
*************************** 1. row ***************************
TENANT_ID: 1
SNAP_ID: 1
SVR_IP: xx.xx.xx.xx
SVR_PORT: 2882
SQL_ID: 02AAEF3D6A4A939843FE958984B6EA51
PLAN_HASH: 8470076267874576774
PLAN_TYPE: 1
MODULE: NULL
ACTION: NULL
PARSING_DB_ID: 201001
PARSING_DB_NAME: oceanbase
PARSING_USER_ID: 200001
EXECUTIONS_TOTAL: 196
EXECUTIONS_DELTA: 196
DISK_READS_TOTAL: 0
DISK_READS_DELTA: 0
BUFFER_GETS_TOTAL: 0
BUFFER_GETS_DELTA: 0
ELAPSED_TIME_TOTAL: 20553
ELAPSED_TIME_DELTA: 20553
CPU_TIME_TOTAL: 0
CPU_TIME_DELTA: 0
CCWAIT_TOTAL: 0
CCWAIT_DELTA: 0
USERIO_WAIT_TOTAL: 0
USERIO_WAIT_DELTA: 0
APWAIT_TOTAL: 0
APWAIT_DELTA: 0
PHYSICAL_READ_REQUESTS_TOTAL: 0
PHYSICAL_READ_REQUESTS_DELTA: 0
PHYSICAL_READ_BYTES_TOTAL: 0
PHYSICAL_READ_BYTES_DELTA: 0
WRITE_THROTTLE_TOTAL: 0
WRITE_THROTTLE_DELTA: 0
ROWS_PROCESSED_TOTAL: 194
ROWS_PROCESSED_DELTA: 194
MEMSTORE_READ_ROWS_TOTAL: 0
MEMSTORE_READ_ROWS_DELTA: 0
MINOR_SSSTORE_READ_ROWS_TOTAL: 0
MINOR_SSSTORE_READ_ROWS_DELTA: 0
MAJOR_SSSTORE_READ_ROWS_TOTAL: 0
MAJOR_SSSTORE_READ_ROWS_DELTA: 0
RPC_TOTAL: 0
RPC_DELTA: 0
FETCHES_TOTAL: 0
FETCHES_DELTA: 0
RETRY_TOTAL: 0
RETRY_DELTA: 0
PARTITION_TOTAL: 196
PARTITION_DELTA: 196
NESTED_SQL_TOTAL: 0
NESTED_SQL_DELTA: 0
SOURCE_IP: xx.xx.xx.xx
SOURCE_PORT: 2882
ROUTE_MISS_TOTAL: 0
ROUTE_MISS_DELTA: 0
FIRST_LOAD_TIME: 2026-02-24 17:42:16.369236
PLAN_CACHE_HIT_TOTAL: 194
PLAN_CACHE_HIT_DELTA: 194
MUTI_QUERY_TOTAL: 0
MUTI_QUERY_DELTA: 0
MUTI_QUERY_BATCH_TOTAL: 0
MUTI_QUERY_BATCH_DELTA: 0
FULL_TABLE_SCAN_TOTAL: 0
FULL_TABLE_SCAN_DELTA: 0
ERROR_COUNT_TOTAL: 0
ERROR_COUNT_DELTA: 0
SAMPLE_TIME: 2026-02-24 17:52:04.000000
LATEST_ACTIVE_TIME: 2026-02-24 17:52:04.179946
1 row in set (0.005 sec)