Note
This view is available starting with V4.0.0.
Purpose
The GV$OB_SQL_AUDIT view displays the source, execution status, and other statistical information of each SQL request on all OBServer nodes. This view is tenant-separated. You can query only the information of the current tenant. The system tenant can query information of other tenants.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| SVR_IP | VARCHAR2(46) | NO | The IP address of the server. |
| SVR_PORT | NUMBER(38) | NO | The port number. |
| REQUEST_ID | NUMBER(38) | NO | The ID of the request. |
| SQL_EXEC_ID | NUMBER(38) | NO | The ID of the current execution. |
| TRACE_ID | VARCHAR2(128) | NO | The trace_id of the statement. |
| SID | NUMBER(38) | NO | For V4.3.x:
|
| CLIENT_IP | VARCHAR2(46) | NO |
|
| CLIENT_PORT | NUMBER(38) | NO | The port number of the client that sends the request. |
| TENANT_ID | NUMBER(38) | NO | The ID of the tenant that sends the request. |
| EFFECTIVE_TENANT_ID | NUMBER(38) | NO | The ID of the tenant. |
| TENANT_NAME | VARCHAR2(64) | NO | The name of the tenant that sends the request. |
| USER_ID | NUMBER(38) | NO | The ID of the user that sends the request. |
| USER_NAME | VARCHAR2(64) | NO | The name of the user that sends the request. |
| USER_GROUP | NUMBER(38) | YES | The ID of the resource group to which the user belongs. |
| USER_CLIENT_IP | VARCHAR2(32) | NO | The IP address of the client that sends the request. |
| DB_ID | NUMBER(38) | NO | The ID of the database. |
| DB_NAME | VARCHAR2(128) | NO | The name of the database. |
| SQL_ID | VARCHAR2(32) | NO | The ID of the SQL statement.
Note
|
| QUERY_SQL | CLOB | NO | The actual SQL statement. |
| PLAN_ID | NUMBER(38) | NO | The ID of the execution plan. |
| AFFECTED_ROWS | NUMBER(38) | NO | The number of affected rows. |
| RETURN_ROWS | NUMBER(38) | NO | The number of returned rows. |
| PARTITION_CNT | NUMBER(38) | NO | The number of partitions involved in the request. |
| RET_CODE | NUMBER(38) | NO | The execution result code.
For more information about error codes, see Error codes. |
| QC_ID | NUMBER(38) | NO | The ID of the scheduler in parallel execution scenarios. |
| DFO_ID | NUMBER(38) | NO | The ID of the current subplan in parallel execution scenarios. |
| SQC_ID | NUMBER(38) | NO | The ID of the local coordinator in parallel execution scenarios. |
| WORKER_ID | NUMBER(38) | NO | The ID of the worker thread in parallel execution scenarios. |
| EVENT | VARCHAR2(64) | YES | The maximum length of the event name. |
| P1TEXT | VARCHAR2(64) | YES | The first parameter of the event. |
| P1 | NUMBER(38) | YES | The value of the first parameter of the event. |
| P2TEXT | VARCHAR2(64) | YES | The second parameter of the event. |
| P2 | NUMBER(38) | YES | The value of the second parameter of the event. |
| P3TEXT | VARCHAR2(64) | YES | The third parameter of the event. |
| P3 | NUMBER(38) | YES | The value of the third parameter of the event. |
| LEVEL | NUMBER(38) | YES | The level of the event. |
| WAIT_CLASS_ID | NUMBER(38) | YES | The ID of the class to which the event belongs. |
| WAIT_CLASS# | NUMBER(38) | YES | The index of the class to which the event belongs. |
| WAIT_CLASS | VARCHAR2(64) | YES | The name of the class to which the event belongs. |
| STATE | VARCHAR2(19) | YES | The state of the event. |
| WAIT_TIME_MICRO | NUMBER(38) | YES | The time the event waited, in microseconds. |
| TOTAL_WAIT_TIME_MICRO | NUMBER(38) | YES | The total time of all waits during execution, in microseconds. |
| TOTAL_WAITS | NUMBER(38) | YES | The total number of waits during execution. |
| RPC_COUNT | NUMBER(38) | YES | The number of RPCs sent. |
| PLAN_TYPE | NUMBER(38) | NO | The type of the execution plan:
|
| IS_INNER_SQL | NUMBER(38) | NO | Indicates whether the request is an internal SQL request. |
| IS_EXECUTOR_RPC | NUMBER(38) | NO | Indicates whether the request is an RPC request. |
| IS_HIT_PLAN | NUMBER(38) | NO | Indicates whether the plan cache was hit. |
| REQUEST_TIME | NUMBER(38) | NO | The start time of execution, in microseconds. |
| ELAPSED_TIME | NUMBER(38) | NO | The total time consumed from receiving the request to the end of execution, in microseconds. |
| NET_TIME | NUMBER(38) | NO | The time from sending the RPC to receiving the request, in microseconds. |
| NET_WAIT_TIME | NUMBER(38) | NO | The time from receiving the request to entering the queue, in microseconds. |
| QUEUE_TIME | NUMBER(38) | NO | The time the request spent in the queue, in microseconds. |
| DECODE_TIME | NUMBER(38) | NO | The time spent decoding after leaving the queue, in microseconds. |
| GET_PLAN_TIME | NUMBER(38) | NO | The time from the start of processing to obtaining the plan, in microseconds. |
| EXECUTE_TIME | NUMBER(38) | NO | The time consumed for plan execution, in microseconds. |
| APPLICATION_WAIT_TIME | NUMBER(38) | YES | The total time of all Application events, in microseconds. |
| CONCURRENCY_WAIT_TIME | NUMBER(38) | YES | The total time of all Concurrency events, in microseconds. |
| USER_IO_WAIT_TIME | NUMBER(38) | YES | The total time of all user_io events, in microseconds. |
| SCHEDULE_TIME | NUMBER(38) | YES | The time of all Schedule events, in microseconds. |
| ROW_CACHE_HIT | NUMBER(38) | YES | The number of row cache hits. |
| BLOOM_FILTER_CACHE_HIT | NUMBER(38) | YES | The number of Bloom Filter cache hits. |
| BLOCK_CACHE_HIT | NUMBER(38) | YES | The number of block cache hits. |
| DISK_READS | NUMBER(38) | YES | The number of physical reads. |
| RETRY_CNT | NUMBER(38) | NO | The number of retries. |
| TABLE_SCAN | NUMBER(38) | NO | Indicates whether the request contains a full table scan. |
| CONSISTENCY_LEVEL | NUMBER(38) | NO | The consistency level. Valid values:
|
| MEMSTORE_READ_ROW_COUNT | NUMBER(38) | YES | The number of rows read from the MemStore before the filter is applied. |
| SSSTORE_READ_ROW_COUNT | NUMBER(38) | YES | The number of rows read from the Major SSTable, Minor SSTable, and Mini SSTable in the push-down or non-push-down path. |
| DATA_BLOCK_READ_CNT | NUMBER(38) | YES | The number of data microblocks accessed. |
| DATA_BLOCK_CACHE_HIT | NUMBER(38) | YES | The number of data microblocks that hit the cache. |
| INDEX_BLOCK_READ_CNT | NUMBER(38) | YES | The number of intermediate microblocks accessed. |
| INDEX_BLOCK_CACHE_HIT | NUMBER(38) | YES | The number of intermediate microblocks that hit the cache. |
| BLOCKSCAN_BLOCK_CNT | NUMBER(38) | YES | The number of microblocks opened in the push-down path. |
| BLOCKSCAN_ROW_CNT | NUMBER(38) | YES | The total number of rows in the range of the microblocks opened in the push-down path. |
| PUSHDOWN_STORAGE_FILTER_ROW_CNT | NUMBER(38) | YES | The total number of rows filtered by the push-down or non-push-down filter. |
| REQUEST_MEMORY_USED | NUMBER(38) | NO | The amount of memory consumed by the request. |
| EXPECT_WORKER_COUNT | NUMBER(38) | NO | The expected number of worker threads for the request. |
| USED_WORKER_COUNT | NUMBER(38) | NO | The actual number of worker threads used by the request. |
| SCHED_INFO | VARCHAR2(16384) | YES | The scheduling information for the request. |
| PS_CLIENT_STMT_ID | NUMBER(38) | NO | The client Prepare ID corresponding to the request.
|
| PS_INNER_STMT_ID | NUMBER(38) | NO | The internal (database-side) Prepare ID corresponding to the request.
|
| TX_ID | NUMBER(38) | NO | The transaction ID corresponding to the request. |
| SNAPSHOT_VERSION | NUMBER(38) | NO | The read snapshot version used by the SQL statement. |
| REQUEST_TYPE | NUMBER(38) | NO | The type of the request.
|
| IS_BATCHED_MULTI_STMT | NUMBER(38) | NO | Whether to optimize Batch Multi Stmt. |
| OB_TRACE_INFO | VARCHAR2(4096) | NO | The trace information set by the user. |
| PLAN_HASH | NUMBER(38) | NO | The hash value of the execution plan. |
| PARAMS_VALUE | CLOB | NO | The parameter values bound to the PS. |
| RULE_NAME | VARCHAR2(256) | NO | The name of the rule.
NoteThis column is available starting with V4.1.0. |
| TX_INTERNAL_ROUTING | NUMBER | NO | Indicates whether the SQL statement has been internally routed.
NoteThis column is available starting with V4.1.0. |
| TX_STATE_VERSION | NUMBER(38) | NO | The transaction state version of the SQL statement.
NoteThis column is available starting with V4.1.0. |
| FLT_TRACE_ID | VARCHAR2(1024) | NO | The trace ID for the full-chain trace of the record. If this field is empty, it indicates that the record is not being monitored by the full-chain trace. This field is a UUID, which is different from the trace. Its format is similar to: 000600d6-a5de-038c-6c80-df07e4e79149
NoteThis column is available starting with V4.2.1. |
| PL_TRACE_ID | VARCHAR2(128) | NO | The trace ID of the outer PL statement. If there is no outer PL statement, this value is NULL.
Note
|
| PLSQL_EXEC_TIME | NUMBER(38) | NO | The execution time of the PL statement, excluding the SQL execution time. The unit is microseconds.
Note
|
| FORMAT_SQL_ID | VARCHAR2(32) | NO | The MD5 value of the SQL text generated by the Format SQL text feature. |
| STMT_TYPE | VARCHAR2(128) | YES | The type of the DML statement. The value can be:
|
| TOTAL_MEMSTORE_READ_ROW_COUNT | NUMBER(38) | NO | The total number of rows read from the MemStore during the entire process. This variable is displayed only in the thread that shows the query text.
Note
|
| TOTAL_SSSTORE_READ_ROW_COUNT | NUMBER(38) | NO | The total number of rows read from the SSSTORE during the entire process. This variable is displayed only in the thread that shows the query text.
Note
|
| PROXY_USER | VARCHAR2(128) | NO |
Note
|
| SEQ_NUM | NUMBER(38) | NO | The sequence number of the statement in the transaction.
Note
|
| NETWORK_WAIT_TIME | NUMBER(38) | YES | The total time of all Network events, in microseconds. |
| PLSQL_COMPILE_TIME | NUMBER(38) | NO | The compilation time of the PL statement.
Note
|
| INSERT_DUPLICATE_ROW_COUNT | NUMBER(38) | YES | The number of duplicate rows in the insertup or replace into operation.
Note |
| USER_CLIENT_PORT | NUMBER(38) | NO | The client port number.
Note
|
| TRANS_STATUS | VARCHAR2(256) | NO | The transaction status. This column displays whether the transaction is explicitly started, implicitly started, or not started.
Note |
| TX_TABLE_READ_CNT | NUMBER(38) | YES | The number of times the transaction status table is queried.
NoteThis column was introduced in V4.5.0 for V4.5.x. |
| OUTROW_LOB_CNT | NUMBER(38) | YES | The number of outrow LOB columns read during the query.
NoteThis column was introduced in V4.5.0 for V4.5.x. |
| COMMIT_TIME | NUMBER(38) | NO | The time taken for the commit SQL to trigger a commit in the transaction. If the SQL does not trigger a commit, the default value is 0.
NoteThis column was introduced in V4.6.0 for V4.6.x. |
| OBJECT_STORAGE_READS | NUMBER(38) | YES |
NoteThis column is available starting with V4.6.0 in V4.6.x. |
Important event intervals
The following figure shows the relationships between the important events corresponding to the ELAPSED_TIME, REQUEST_TIME, NET_WAIT_TIME, QUEUE_TIME, DECODE_TIME, GET_PLAN_TIME, EXECUTE_TIME, and COMMIT_TIME columns in this view:
Sample query
Query the source, execution status, and other statistical information for each SQL request on all OBServer nodes.
obclient [SYS]> SELECT * FROM SYS.GV$OB_SQL_AUDIT WHERE ROWNUM <= 1\G
The query result is as follows:
*************************** 1. row ***************************
SVR_IP: 172.xx.xxx.xxx
SVR_PORT: 2882
REQUEST_ID: 1703936
SQL_EXEC_ID: 17707244
TRACE_ID: xxxxxxxx-xxxxxxxx-0-0
SID: 3221740629
CLIENT_IP: 0.0.0.0
CLIENT_PORT: 0
TENANT_ID: 1004
EFFECTIVE_TENANT_ID: 1004
TENANT_NAME: sys
USER_ID: 200001
USER_NAME: root
USER_GROUP: 0
USER_CLIENT_IP: 0.0.0.0
DB_ID: 201001
DB_NAME: oceanbase
SQL_ID: B7A6FA97FEC98C06F9586D23935AC4C6
QUERY_SQL: NULL
PLAN_ID: 0
AFFECTED_ROWS: 0
RETURN_ROWS: 0
PARTITION_CNT: 0
RET_CODE: 0
QC_ID: 0
DFO_ID: 0
SQC_ID: 0
WORKER_ID: 0
EVENT: exec inner sql wait
P1TEXT: wait inner sql class
P1: 0
P2TEXT: inner session id
P2: 4611686018441083478
P3TEXT: NULL
P3: 0
LEVEL: 0
WAIT_CLASS_ID: 100
WAIT_CLASS#: 0
WAIT_CLASS: OTHER
STATE: WAITED SHORT TIME
WAIT_TIME_MICRO: 13
TOTAL_WAIT_TIME_MICRO: 13
TOTAL_WAITS: 1
RPC_COUNT: 0
PLAN_TYPE: 0
IS_INNER_SQL: 1
IS_EXECUTOR_RPC: 0
IS_HIT_PLAN: 0
REQUEST_TIME: 1749806176360832
ELAPSED_TIME: 150
NET_TIME: 0
NET_WAIT_TIME: 0
QUEUE_TIME: 0
DECODE_TIME: 0
GET_PLAN_TIME: 137
EXECUTE_TIME: 13
APPLICATION_WAIT_TIME: 0
CONCURRENCY_WAIT_TIME: 0
USER_IO_WAIT_TIME: 0
SCHEDULE_TIME: 0
ROW_CACHE_HIT: 0
BLOOM_FILTER_CACHE_HIT: 0
BLOCK_CACHE_HIT: 0
DISK_READS: 0
RETRY_CNT: 0
TABLE_SCAN: 0
CONSISTENCY_LEVEL: -1
MEMSTORE_READ_ROW_COUNT: 0
SSSTORE_READ_ROW_COUNT: 0
DATA_BLOCK_READ_CNT: 0
DATA_BLOCK_CACHE_HIT: 0
INDEX_BLOCK_READ_CNT: 0
INDEX_BLOCK_CACHE_HIT: 0
BLOCKSCAN_BLOCK_CNT: 0
BLOCKSCAN_ROW_CNT: 0
PUSHDOWN_STORAGE_FILTER_ROW_CNT: 0
REQUEST_MEMORY_USED: 73728
EXPECTED_WORKER_COUNT: 0
USED_WORKER_COUNT: 0
SCHED_INFO: NULL
PS_CLIENT_STMT_ID: -1
PS_INNER_STMT_ID: -1
TX_ID: 328811
SNAPSHOT_VERSION: 0
REQUEST_TYPE: 1
IS_BATCHED_MULTI_STMT: 0
OB_TRACE_INFO: NULL
PLAN_HASH: 0
PARAMS_VALUE: NULL
RULE_NAME: NULL
TX_INTERNAL_ROUTING: 0
TX_STATE_VERSION: 0
FLT_TRACE_ID: NULL
PL_TRACE_ID: NULL
PLSQL_EXEC_TIME: 0
FORMAT_SQL_ID: NULL
STMT_TYPE: START_TRANS
TOTAL_MEMSTORE_READ_ROW_COUNT: 0
TOTAL_SSSTORE_READ_ROW_COUNT: 0
PROXY_USER: NULL
SEQ_NUM: 1749806176357985
NETWORK_WAIT_TIME: 0
PLSQL_COMPILE_TIME: 0
INSERT_DUPLICATE_ROW_COUNT: 0
USER_CLIENT_PORT: 0
TRANS_STATUS: Enable committable transaction
CCL_RULE_ID: 0
CCL_MATCH_TIME: 0
TX_TABLE_READ_CNT: 0
OUTROW_LOB_CNT: 0
COMMIT_TIME: 0
OBJECT_STORAGE_READS: 0
