Note
- This view is available starting with V4.3.5 for V4.3.x.
- This view is available starting with V4.2.2 for V4.2.x.
Purpose
The DBA_WR_SQLSTAT view displays the basic performance statistics of SQL statements executed in the current tenant. Each SQL statement is represented by a row (i.e., each unique combination of SQL_ID and Plan_Hash). The columns with _DELTA in their names indicate the incremental statistics from the last WR snapshot collection to the current time.
Columns
Column |
Type |
Nullable |
Description |
|---|---|---|---|
| SNAP_ID | bigint(20) | NO | The snapshot ID. |
| SVR_IP | varchar(46) | NO | The IP address of the node. |
| SVR_PORT | bigint(20) | NO | The port number of the node. |
| SQL_ID | varchar(32) | NO | The SQL statement ID. |
| PLAN_HASH | bigint(20) unsigned | NO | The hash value of the execution plan. |
| PLAN_ID | bigint(20) | NO | The execution plan ID. |
| PLAN_TYPE | bigint(20) | NO | For SQL plan caching, this column indicates the type of the plan:
For PL/SQL object caching, this column indicates the type of the PL/SQL object:
|
| MODULE | varchar(64) | YES | The application module of the statement when it was first parsed. |
| ACTION | varchar(64) | YES | The application action of the statement when it was first parsed. |
| PARSING_DB_ID | bigint(20) | NO | The database ID when the statement was parsed. |
| PARSING_DB_NAME | varchar(128) | NO | The database name when the statement was parsed. |
| PARSING_USER_ID | bigint(20) | NO | The user ID when the statement was parsed. |
| EXECUTIONS_TOTAL | bigint(20) | NO | The total number of executions of the plan in the plan cache. |
| EXECUTIONS_DELTA | bigint(20) | NO | The incremental number of executions of the plan in the plan cache. |
| DISK_READS_TOTAL | bigint(20) | NO | The total number of disk reads. |
| DISK_READS_DELTA | bigint(20) | NO | The incremental number of disk reads. |
| BUFFER_GETS_TOTAL | bigint(20) | NO | The total number of logical reads from the cache. |
| BUFFER_GETS_DELTA | bigint(20) | NO | The incremental number of logical reads from the cache. |
| ELAPSED_TIME_TOTAL | bigint(20) | NO | The total time consumed by the statement. For parallel execution scenarios, this value is the sum of the elapsed times of each execution thread. |
| ELAPSED_TIME_DELTA | bigint(20) | NO | The incremental time consumed by the statement. |
| CPU_TIME_TOTAL | bigint(20) | NO | The total CPU time consumed. |
| CPU_TIME_DELTA | bigint(20) | NO | The incremental CPU time consumed. |
| CCWAIT_TOTAL | bigint(20) | NO | The total time consumed by concurrency-related wait events. |
| CCWAIT_DELTA | bigint(20) | NO | The incremental time consumed by concurrency-related wait events. |
| USERIO_WAIT_TOTAL | bigint(20) | NO | The total time consumed by I/O waits. |
| USERIO_WAIT_DELTA | bigint(20) | NO | The incremental time consumed by I/O waits. |
| APWAIT_TOTAL | bigint(20) | NO | The total time consumed by application-related wait events. |
| APWAIT_DELTA | bigint(20) | NO | The incremental time consumed by application-related wait events. |
| PHYSICAL_READ_REQUESTS_TOTAL | bigint(20) | NO | The total number of physical read requests. |
| PHYSICAL_READ_REQUESTS_DELTA | bigint(20) | NO | The incremental number of physical read requests. |
| PHYSICAL_READ_BYTES_TOTAL | bigint(20) | NO | The total number of bytes read physically. |
| PHYSICAL_READ_BYTES_DELTA | bigint(20) | NO | The incremental number of bytes read physically. |
| WRITE_THROTTLE_TOTAL | bigint(20) | NO | The total time spent throttling writes to the MemStore. |
| WRITE_THROTTLE_DELTA | bigint(20) | NO | The incremental time spent throttling writes to the MemStore. |
| ROWS_PROCESSED_TOTAL | bigint(20) | NO | The total number of rows processed by the statement. |
| ROWS_PROCESSED_DELTA | bigint(20) | NO | The total number of rows processed by the statement. |
| MEMSTORE_READ_ROWS_TOTAL | bigint(20) | NO | The total number of rows read from the MemStore. |
| MEMSTORE_READ_ROWS_DELTA | bigint(20) | NO | The total number of rows read from the MemStore. |
| MINOR_SSSTORE_READ_ROWS_TOTAL | bigint(20) | NO | The total number of rows read from the MINOR SSStore. |
| MINOR_SSSTORE_READ_ROWS_DELTA | bigint(20) | NO | The total number of rows read from the MINOR SSStore. |
| MAJOR_SSSTORE_READ_ROWS_TOTAL | bigint(20) | NO | The total number of rows read from the MAJOR SSStore. |
| MAJOR_SSSTORE_READ_ROWS_DELTA | bigint(20) | NO | The total number of rows read from the MAJOR SSStore. |
| RPC_TOTAL | bigint(20) | NO | The total number of RPC requests. |
| RPC_DELTA | bigint(20) | NO | The number of RPC requests. |
| FETCHES_TOTAL | bigint(20) | NO | The total number of result set fetches. |
| FETCHES_DELTA | bigint(20) | NO | The number of result set fetches. |
| RETRY_TOTAL | bigint(20) | NO | The total number of SQL retries. |
| RETRY_DELTA | bigint(20) | NO | The number of SQL retries. |
| PARTITION_TOTAL | bigint(20) | NO | The total number of partitions scanned by the SQL statement. |
| PARTITION_DELTA | bigint(20) | NO | The number of partitions scanned by the SQL statement. |
| NESTED_SQL_TOTAL | bigint(20) | NO | The total number of nested SQL statements executed. Each time a sub-SQL statement is executed, the value increases by 1. |
| NESTED_SQL_DELTA | bigint(20) | NO | The number of nested SQL statements executed. |
| SOURCE_IP | varchar(46) | NO | The IP address of the request source. |
| SOURCE_PORT | bigint(20) | NO | The port number of the request source. |
| ROUTE_MISS_TOTAL | bigint(20) | NO | The total number of times the request partition was not hit since the OBServer started.
Note
|
| ROUTE_MISS_DELTA | bigint(20) | NO | The number of times the request partition was not hit since the last WR snapshot collection started.
Note
|
| FIRST_LOAD_TIME | timestamp(6) | YES | The time when the plan was generated.
Note
|
| PLAN_CACHE_HIT_TOTAL | bigint(20) | NO | The total number of times the plan cache was hit since the OBServer started.
Note
|
| PLAN_CACHE_HIT_DELTA | bigint(20) | NO | The number of times the plan cache was hit since the last WR snapshot collection started.
Note
|
| MUTI_QUERY_TOTAL | bigint(20) | NO | The number of times the SQL statement was in a multi-query since the execution plan was generated.
NoteFor V4.4.x, this field was introduced in V4.4.2. |
| MUTI_QUERY_DELTA | bigint(20) | NO | The number of times the SQL statement was in a multi-query since the last WR snapshot collection.
NoteFor V4.4.x, this field was introduced in V4.4.2. |
| MUTI_QUERY_BATCH_TOTAL | bigint(20) | NO | The number of times the SQL batch was executed since the execution plan was generated.
NoteFor V4.4.x, this field was introduced in V4.4.2. |
| MUTI_QUERY_BATCH_DELTA | bigint(20) | NO | The number of times this SQL batch has been executed since the last WR snapshot was collected.
NoteFor V4.4.x versions, this column was introduced starting from V4.4.2. |
| FULL_TABLE_SCAN_TOTAL | bigint(20) | NO | The number of full table scans performed by this SQL since the execution plan was generated.
NoteFor V4.4.x versions, this column was introduced starting from V4.4.2. |
| FULL_TABLE_SCAN_DELTA | bigint(20) | NO | The number of full table scans performed by this SQL since the last WR snapshot was collected.
NoteFor V4.4.x versions, this column was introduced starting from V4.4.2. |
| ERROR_COUNT_TOTAL | bigint(20) | NO | The number of errors reported by this SQL since the execution plan was generated.
NoteFor V4.4.x versions, this column was introduced starting from V4.4.2. |
| ERROR_COUNT_DELTA | bigint(20) | NO | The number of errors reported by this SQL since the last WR snapshot was collected.
NoteFor V4.4.x versions, this column was introduced starting from V4.4.2. |
| SAMPLE_TIME | timestamp(6) | NO | The time when the SQLSTAT snapshot was written to disk. In one WR snapshot interval, SQLSTAT may be written to disk multiple times.
NoteFor V4.4.x versions, this column was introduced starting from V4.4.2. |
| LATEST_ACTIVE_TIME | timestamp(6) | YES | The last active time of the plan corresponding to the SQL ID + Plan Hash on a node.
NoteFor V4.4.x versions, this column was introduced starting from V4.4.2. |
Sample query
Query the basic performance statistics of SQL statements executed in the current tenant and display the first record.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_WR_SQLSTAT LIMIT 1\G
The query result is as follows:
*************************** 1. row ***************************
SNAP_ID: 1
SVR_IP: xx.xx.xx.xx
SVR_PORT: 2882
SQL_ID: 01058E374A5EF26873BA4D99C4A74582
PLAN_HASH: 5547575357486659143
PLAN_TYPE: 0
MODULE: NULL
ACTION: NULL
PARSING_DB_ID: 0
PARSING_DB_NAME:
PARSING_USER_ID: 4282320133
EXECUTIONS_TOTAL: 1
EXECUTIONS_DELTA: 1
DISK_READS_TOTAL: 0
DISK_READS_DELTA: 0
BUFFER_GETS_TOTAL: 0
BUFFER_GETS_DELTA: 0
ELAPSED_TIME_TOTAL: 1402
ELAPSED_TIME_DELTA: 1402
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: 0
ROWS_PROCESSED_DELTA: 0
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: 1
PARTITION_DELTA: 1
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:53:53.855481
PLAN_CACHE_HIT_TOTAL: 0
PLAN_CACHE_HIT_DELTA: 0
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:53:53.000000
LATEST_ACTIVE_TIME: 2026-02-24 17:47:08.295747
1 row in set (0.153 sec)
