Note
Introduced in MySQL 4.0.0.
Description
The GV$OB_SQL_AUDIT view displays the source and execution status of each SQL request on all OBServer nodes. This view is tenant-wise. Tenants other than the sys tenant cannot cross-tenant query the view.
Field descriptions
| Field name | Type | Nullable | Description |
|---|---|---|---|
| SVR_IP | VARCHAR2(46) | NO | IP address |
| SVR_PORT | NUMBER(38) | NO | Port number |
| REQUEST_ID | NUMBER(38) | NO | ID of the request |
| SQL_EXEC_ID | NUMBER(38) | NO | ID of the current execution |
| TRACE_ID | VARCHAR2(128) | NO | Trace ID of the statement |
| SID | NUMBER(38) | NO | ID of the session connection |
| CLIENT_IP | VARCHAR2(46) | NO | |
| CLIENT_PORT | NUMBER(38) | NO | Port number of the client that sends the request |
| TENANT_ID | NUMBER(38) | NO | Tenant ID of the client that sends the request |
| EFFECTIVE_TENANT_ID | NUMBER(38) | NO | Tenant ID |
| TENANT_NAME | VARCHAR2(64) | NO | Tenant name of the client that sends the request |
| USER_ID | NUMBER(38) | NO | User ID of the client that sends the request |
| USER_NAME | VARCHAR2(64) | NO | Username of the client that sends the request |
| USER_GROUP | NUMBER(38) | YES | ID of the resource group to which the user belongs |
| USER_CLIENT_IP | VARCHAR2(32) | NO | IP address of the client that sends the request |
| DB_ID | NUMBER(38) | NO | Database ID |
| DB_NAME | VARCHAR2(128) | NO | Database name |
| SQL_ID | VARCHAR2(32) | NO | ID of the SQL statement |
| QUERY_SQL | CLOB | NO | Actual SQL statement |
| PLAN_ID | NUMBER(38) | NO | ID of the execution plan |
| AFFECTED_ROWS | NUMBER(38) | NO | Number of affected rows |
| RETURN_ROWS | NUMBER(38) | NO | Number of returned rows |
| PARTITION_CNT | NUMBER(38) | NO | Number of partitions involved in the request |
| RET_CODE | NUMBER(38) | NO | Return code of the execution result: |
| QC_ID | NUMBER(38) | NO | Scheduler ID in parallel execution |
| DFO_ID | NUMBER(38) | NO | ID of the current subplan in parallel execution |
| SQC_ID | NUMBER(38) | NO | ID of the local coordinator in parallel execution |
| WORKER_ID | NUMBER(38) | NO | ID of the worker thread in parallel execution |
| EVENT | VARCHAR2(64) | YES | Name of the longest waiting event |
| P1TEXT | VARCHAR2(64) | YES | Parameter 1 of the waiting event |
| P1 | NUMBER(38) | YES | Value of parameter 1 |
| P2TEXT | VARCHAR2(64) | YES | Parameter 2 of the waiting event |
| P2 | NUMBER(38) | YES | Value of parameter 2 |
| P3TEXT | VARCHAR2(64) | YES | Parameter 3 of the waiting event |
| P3 | NUMBER(38) | YES | Value of parameter 3 |
| LEVEL | NUMBER(38) | YES | Priority of the waiting event |
| WAIT_CLASS_ID | NUMBER(38) | YES | Class ID to which the waiting event belongs |
| WAIT_CLASS# | NUMBER(38) | YES | Index of the class to which the waiting event belongs |
| WAIT_CLASS | VARCHAR2(64) | YES | Name of the class to which the waiting event belongs |
| STATE | VARCHAR2(19) | YES | State of the waiting event |
| WAIT_TIME_MICRO | NUMBER(38) | YES | Duration of the wait for the event, in microseconds |
| TOTAL_WAIT_TIME_MICRO | NUMBER(38) | YES | Total wait time of the execution process, in microseconds |
| TOTAL_WAITS | NUMBER(38) | YES | Total number of waits in the execution process |
| RPC_COUNT | NUMBER(38) | YES | Number of RPCs sent |
| PLAN_TYPE | NUMBER(38) | NO | 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 current request is an RPC request |
| IS_HIT_PLAN | NUMBER(38) | NO | Indicates whether the plan is found in the plan cache |
| REQUEST_TIME | NUMBER(38) | NO | Start time of the execution, in microseconds |
| ELAPSED_TIME | NUMBER(38) | NO | Total time taken from receiving the request to the end of the execution, in microseconds |
| NET_TIME | NUMBER(38) | NO | Time taken from sending the RPC request to receiving the request, in microseconds |
| NET_WAIT_TIME | NUMBER(38) | NO | Time taken from receiving the request to entering the queue, in microseconds |
| QUEUE_TIME | NUMBER(38) | NO | Time that the request waits in the queue, in microseconds |
| DECODE_TIME | NUMBER(38) | NO | Time taken to decode the request after it is dequeued, in microseconds |
| GET_PLAN_TIME | NUMBER(38) | NO | Time taken from the start of the process to obtaining an execution plan, in microseconds |
| EXECUTE_TIME | NUMBER(38) | NO | Execution time of the plan, in microseconds |
| APPLICATION_WAIT_TIME | NUMBER(38) | YES | Total duration of all application-related events, in microseconds |
| CONCURRENCY_WAIT_TIME | NUMBER(38) | YES | Total duration of all concurrency-related events, in microseconds |
| USER_IO_WAIT_TIME | NUMBER(38) | YES | Total duration of all user I/O-related events, in microseconds |
| SCHEDULE_TIME | NUMBER(38) | YES | Total duration of all scheduling-related events, in microseconds |
| ROW_CACHE_HIT | NUMBER(38) | YES | Number of cache hits in the row cache |
| BLOOM_FILTER_CACHE_HIT | NUMBER(38) | YES | Number of cache hits in the Bloom filter cache |
| BLOCK_CACHE_HIT | NUMBER(38) | YES | Number of cache hits in the block cache |
| DISK_READS | NUMBER(38) | YES | Number of physical reads |
| RETRY_CNT | NUMBER(38) | NO | Number of retries |
| TABLE_SCAN | NUMBER(38) | NO | Indicates whether the request contains a full-table scan |
| CONSISTENCY_LEVEL | NUMBER(38) | NO | Consistency level. The possible values are as follows:
|
| MEMSTORE_READ_ROW_COUNT | NUMBER(38) | YES | Number of rows read from Memstores |
| SSSTORE_READ_ROW_COUNT | NUMBER(38) | YES | Number of rows read from Ssstores |
| DATA_BLOCK_READ_CNT | bigint(20) | YES | Number of data microblocks accessed |
| DATA_BLOCK_CACHE_HIT | bigint(20) | YES | Number of times data microblocks are cached |
| INDEX_BLOCK_READ_CNT | bigint(20) | YES | Number of index microblocks accessed |
| INDEX_BLOCK_CACHE_HIT | bigint(20) | YES | Number of times index microblocks are cached |
| BLOCKSCAN_BLOCK_CNT | bigint(20) | YES | Number of data microblocks for block-based scan |
| BLOCKSCAN_ROW_CNT | bigint(20) | YES | Number of data rows for block-based scan |
| PUSHDOWN_STORAGE_FILTER_ROW_CNT | bigint(20) | YES | Number of rows filtered by storage filter and pushed down |
| REQUEST_MEMORY_USED | NUMBER(38) | NO | Memory used by the request |
| EXPECT_WORKER_COUNT | NUMBER(38) | NO | Expected number of worker threads for the request |
| USED_WORKER_COUNT | NUMBER(38) | NO | Actual number of worker threads used by the request |
| SCHED_INFO | VARCHAR2(16384) | YES | Scheduling information of the request |
| PS_CLIENT_STMT_ID | bigint(20) | NO | Prepare ID corresponding to the request:
|
| PS_INNER_STMT_ID | bigint(20) | NO | Prepare ID corresponding to the request:
|
| TX_ID | bigint(20) | NO | ID of the transaction corresponding to the request |
| SNAPSHOT_VERSION | bigint(20) | NO | Version of the read snapshot used by the SQL statement |
| REQUEST_TYPE | NUMBER(38) | NO | Type of the request: |
| IS_BATCHED_MULTI_STMT | NUMBER(38) | NO | Indicates whether batch multi-statement optimization is applied. |
| OB_TRACE_INFO | VARCHAR2(4096) | NO | User-set trace information |
| PLAN_HASH | NUMBER(38) | NO | Hash value of the execution plan |
| PARAMS_VALUE | CLOB | NO | Values of parameters bound in the PS protocol |
| RULE_NAME | VARCHAR2(256) | NO | Rule name
NoteThis field is introduced in V4.1.0. |
| TX_INTERNAL_ROUTING | NUMBER | NO | Indicates whether transaction routing is enabled for the transaction:
Note
|
| TX_STATE_VERSION | NUMBER(38) | NO | The version number is incremented if the transaction state changes after transaction routing is enabled; it remains unchanged if the transaction state does not change.
Note
|
| FLT_TRACE_ID | VARCHAR2(1024) | NO | Trace ID for full-featured tracing of the entire request. If this field is empty, full-featured tracing is not performed for the request. The value of this field is a UUID, which is different from the Trace ID. It is in the format of 000600d6-a5de-038c-6c80-df07e4e79149.
NoteThis field is introduced in V4.2.1. |
| PL_TRACE_ID | VARCHAR2(128) | NO | Trace ID of the outer PL of the current SQL statement (NULL if the current SQL statement does not have an outer PL).
Note
|
| PLSQL_EXEC_TIME | NUMBER(38) | NO | Execution duration of the PL (excluding the SQL execution duration), in microseconds
Note
|
| TOTAL_MEMSTORE_READ_ROW_COUNT | NUMBER(38) | NO | Total number of rows read from MemStores during the entire process (displayed only in threads where query_text is displayed).
Note
|
| TOTAL_SSSTORE_READ_ROW_COUNT | NUMBER(38) | NO | Total number of rows read from SSSTORE during the entire process (displayed only in threads where query_text is displayed).
Note
|
Examples
Query the source and execution status of every 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.xx.xx
SVR_PORT: 2882
REQUEST_ID: 1430664
SQL_EXEC_ID: 17156166
TRACE_ID: YB4XXXXXXXXX-000XXXXXXXXXXXXX-0-0
SID: 1
CLIENT_IP: 0.0.0.0
CLIENT_PORT: 0
TENANT_ID: 1
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: 2EAAA3C495632AB97F13659E429FC9CD
QUERY_SQL: select * from __all_balance_task where parent_list is null or parent_list = ''
PLAN_ID: 271
AFFECTED_ROWS: 0
RETURN_ROWS: 0
PARTITION_CNT: 1
RET_CODE: 0
QC_ID: 0
DFO_ID: 0
SQC_ID: 0
WORKER_ID: 0
EVENT: NULL
P1TEXT: NULL
P1: 0
P2TEXT: NULL
P2: 0
P3TEXT: NULL
P3: 0
LEVEL: 0
WAIT_CLASS_ID: 100
WAIT_CLASS#: 0
WAIT_CLASS: OTHER
STATE: MAX_WAIT TIME ZERO
WAIT_TIME_MICRO: 0
TOTAL_WAIT_TIME_MICRO: 0
TOTAL_WAITS: 0
RPC_COUNT: 0
PLAN_TYPE: 1
IS_INNER_SQL: 1
IS_EXECUTOR_RPC: 0
IS_HIT_PLAN: 1
REQUEST_TIME: 1722926232105569
ELAPSED_TIME: 107
NET_TIME: 0
NET_WAIT_TIME: 0
QUEUE_TIME: 0
DECODE_TIME: 0
GET_PLAN_TIME: 53
EXECUTE_TIME: 54
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: 1
CONSISTENCY_LEVEL: 3
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: 0
SNAPSHOT_VERSION: 1722926231708605400
REQUEST_TYPE: 1
IS_BATCHED_MULTI_STMT: 0
OB_TRACE_INFO: NULL
PLAN_HASH: 1945082731509197303
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
TOTAL_MEMSTORE_READ_ROW_COUNT: 0
TOTAL_SSSTORE_READ_ROW_COUNT: 0
1 row in set