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 perform cross-tenant queries.
Field description
| Field name | Type | Null | Description |
|---|---|---|---|
| SVR_IP | varchar(46) | NO | IP address |
| SVR_PORT | bigint(20) | NO | Port number |
| REQUEST_ID | bigint(20) | NO | ID of the request |
| SQL_EXEC_ID | bigint(20) | NO | ID of the current execution |
| TRACE_ID | varchar(128) | NO | Trace ID of the statement |
| SID | bigint(20) unsigned | NO | ID of the session connection |
| CLIENT_IP | varchar(46) | NO | |
| CLIENT_PORT | bigint(20) | NO | Port number of the client that sends the request |
| TENANT_ID | bigint(20) | NO | ID of the tenant that sends the request |
| TENANT_NAME | varchar(64) | NO | Name of the tenant that sends the request |
| EFFECTIVE_TENANT_ID | bigint(20) | NO | Tenant ID |
| USER_ID | bigint(20) | NO | ID of the user that sends the request |
| USER_NAME | varchar(64) | NO | Name of the user that sends the request |
| USER_GROUP | bigint(20) | YES | ID of the resource group to which the user belongs. |
| USER_CLIENT_IP | varchar(46) | NO | IP address of the client that sends the request |
| DB_ID | bigint(20) unsigned | NO | Database ID |
| DB_NAME | varchar(128) | NO | Database name |
| SQL_ID | varchar(32) | NO | ID of the SQL statement. |
| QUERY_SQL | longtext | NO | Actual SQL statement. |
| PLAN_ID | bigint(20) | NO | ID of the execution plan. |
| AFFECTED_ROWS | bigint(20) | NO | Number of affected rows. |
| RETURN_ROWS | bigint(20) | NO | Number of returned rows. |
| PARTITION_CNT | bigint(20) | NO | Number of partitions involved in the request. |
| RET_CODE | bigint(20) | NO | Return code of the execution result: |
| QC_ID | bigint(20) unsigned | NO | ID of the scheduler in parallel execution. |
| DFO_ID | bigint(20) | NO | ID of the current subplan in parallel execution. |
| SQC_ID | bigint(20) | NO | ID of the local coordinator in parallel execution. |
| WORKER_ID | bigint(20) | NO | ID of the worker thread in parallel execution. |
| EVENT | varchar(64) | NO | Name of the longest waiting event. |
| P1TEXT | varchar(64) | NO | Parameter 1 of the waiting event. |
| P1 | bigint(20) unsigned | NO | Value of parameter 1. |
| P2TEXT | varchar(64) | NO | Parameter 2 of the waiting event. |
| P2 | bigint(20) unsigned | NO | Value of parameter 2. |
| P3TEXT | varchar(64) | NO | Parameter 3 of the waiting event. |
| P3 | bigint(20) unsigned | NO | Value of parameter 3. |
| LEVEL | bigint(20) | NO | Priority of the waiting event. |
| WAIT_CLASS_ID | bigint(20) | NO | ID of the class to which the waiting event belongs. |
| WAIT_CLASS# | bigint(20) | NO | Index of the class to which the waiting event belongs. |
| WAIT_CLASS | varchar(64) | NO | Name of the class to which the waiting event belongs. |
| STATE | varchar(19) | NO | State of the waiting event. |
| WAIT_TIME_MICRO | bigint(20) | NO | Duration of the wait, in microseconds. |
| TOTAL_WAIT_TIME_MICRO | bigint(20) | NO | Total wait time of the execution process, in microseconds. |
| TOTAL_WAITS | bigint(20) | NO | Total number of waits in the execution process. |
| RPC_COUNT | bigint(20) | NO | Number of RPCs sent. |
| PLAN_TYPE | bigint(20) | NO | Type of the execution plan: |
| IS_INNER_SQL | tinyint(4) | NO | Indicates whether the request is an internal SQL request. |
| IS_EXECUTOR_RPC | tinyint(4) | NO | Indicates whether the current request is an RPC request. |
| IS_HIT_PLAN | tinyint(4) | NO | Indicates whether the request hits the plan cache. |
| REQUEST_TIME | bigint(20) | NO | Start time of the execution, in microseconds. |
| ELAPSED_TIME | bigint(20) | NO | Total time taken from receiving the request to the end of the execution, in microseconds. |
| NET_TIME | bigint(20) | NO | Time taken from sending the RPC request to receiving the request, in microseconds. |
| NET_WAIT_TIME | bigint(20) | NO | Time taken from receiving the request to entering the queue, in microseconds. |
| QUEUE_TIME | bigint(20) | NO | Waiting time of the request in the queue, in microseconds. |
| DECODE_TIME | bigint(20) | NO | Decoding time after the request is dequeued, in microseconds. |
| GET_PLAN_TIME | bigint(20) | NO | Time taken from the start of the process to obtaining an execution plan, in microseconds. |
| EXECUTE_TIME | bigint(20) | NO | Execution time of the plan, in microseconds. |
| APPLICATION_WAIT_TIME | bigint(20) unsigned | NO | Total time of application-related events, in microseconds. |
| CONCURRENCY_WAIT_TIME | bigint(20) unsigned | NO | Total time of concurrency-related events, in microseconds. |
| USER_IO_WAIT_TIME | bigint(20) unsigned | NO | Total time of user I/O-related events, in microseconds. |
| SCHEDULE_TIME | bigint(20) unsigned | NO | Total time of scheduling-related events, in microseconds. |
| ROW_CACHE_HIT | bigint(20) | NO | Number of cache hits in the row cache. |
| BLOOM_FILTER_CACHE_HIT | bigint(20) | NO | Number of cache hits in the bloom filter cache. |
| BLOCK_CACHE_HIT | bigint(20) | NO | Number of cache hits in the block cache. |
| DISK_READS | bigint(20) | NO | Number of physical reads. |
| RETRY_CNT | bigint(20) | NO | Number of retries. |
| TABLE_SCAN | tinyint(4) | NO | Indicates whether the request contains a full-table scan. |
| CONSISTENCY_LEVEL | bigint(20) | NO | Consistency level. Valid values are as follows:
|
| MEMSTORE_READ_ROW_COUNT | bigint(20) | NO | Number of rows read from MemStores. |
| SSSTORE_READ_ROW_COUNT | bigint(20) | NO | Number of rows read from SSStores. |
| DATA_BLOCK_READ_CNT | bigint(20) | NO | Number of data microblocks accessed. |
| DATA_BLOCK_CACHE_HIT | bigint(20) | NO | Number of cache hits in the data microblock cache. |
| INDEX_BLOCK_READ_CNT | bigint(20) | NO | Number of intermediate-layer microblocks accessed. |
| INDEX_BLOCK_CACHE_HIT | bigint(20) | NO | Number of cache hits in the intermediate-layer microblock cache. |
| BLOCKSCAN_BLOCK_CNT | bigint(20) | NO | Number of data microblocks for single-direction scan. |
| BLOCKSCAN_ROW_CNT | bigint(20) | NO | Number of data rows for single-direction scan. |
| PUSHDOWN_STORAGE_FILTER_ROW_CNT | bigint(20) | NO | Number of rows filtered by storage filter pushdown. |
| REQUEST_MEMORY_USED | bigint(20) | NO | Memory used by the request. |
| EXPECTED_WORKER_COUNT | bigint(20) | NO | Expected number of worker threads. |
| USED_WORKER_COUNT | bigint(20) | NO | Actual number of worker threads used. |
| SCHED_INFO | varchar(16384) | YES | Scheduling information of the request. |
| FUSE_ROW_CACHE_HIT | bigint(20) | NO | Not supported. The value of this field is NULL by default. |
| PS_CLIENT_STMT_ID | bigint(20) | NO | Prepare ID of the request:
|
| PS_INNER_STMT_ID | bigint(20) | NO | Prepare ID of the request:
|
| TX_ID | bigint(20) | NO | ID of the transaction to which the request corresponds. |
| SNAPSHOT_VERSION | bigint(20) | NO | Version number of the read snapshot used by the SQL statement. |
| REQUEST_TYPE | bigint(20) | NO | Type of the request: |
| IS_BATCHED_MULTI_STMT | tinyint(4) | NO | Indicates whether the batch multi-statement optimization is applied to the request. |
| OB_TRACE_INFO | varchar(4096) | NO | Trace information set by the user. |
| PLAN_HASH | bigint(20) unsigned | NO | Hash value of the execution plan. |
| LOCK_FOR_READ_TIME | bigint(20) | NO | Duration of waiting for locks when data is read, in microseconds. |
| PARAMS_VALUE | longtext | NO | Values of the parameters bound in the PS protocol. |
| RULE_NAME | varchar(256) | NO | Rule name.
NoteThis field is introduced in V4.1.0. |
| PARTITION_HIT | tinyint(4) | NO |
NoteThis field is introduced in V4.1.0. |
| TX_INTERNAL_ROUTING | bigint(20) | NO | Indicates whether transaction routing is enabled for the transaction to which the request corresponds:
Note
|
| TX_STATE_VERSION | bigint(20) unsigned | 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 | varchar(1024) | NO | Trace ID for full-featured trace of the entire request. If this field is empty, the request is not monitored by full-featured trace. The value of this field is a UUID, which is different from the trace ID. Its format is similar to the following example: 000600d6-a5de-038c-6c80-df07e4e79149
NoteThis field is introduced in V4.2.1. |
| PL_TRACE_ID | varchar(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 | bigint(20) | NO | Execution time of the PL (excluding the SQL execution time), in microseconds
Note
|
| TOTAL_MEMSTORE_READ_ROW_COUNT | bigint(20) | NO | Total number of rows read from MemStores during the entire execution process (displayed only in threads where query_text is displayed).
Note
|
| TOTAL_SSSTORE_READ_ROW_COUNT | bigint(20) | NO | Total number of rows read from SSSTORE during the entire execution process (displayed only in threads where query_text is displayed).
Note
|
Example
Query the source and execution status of every SQL request on all OBServer nodes.
obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_SQL_AUDIT LIMIT 1\G
The query result is as follows:
*************************** 1. row ***************************
SVR_IP: 172.xx.xx.xx
SVR_PORT: 2882
REQUEST_ID: 1410601
SQL_EXEC_ID: 17357860
TRACE_ID: YB4XXXXXXXXX-000XXXXXXXXXXXXX-0-0
SID: 1
CLIENT_IP: 0.0.0.0
CLIENT_PORT: 0
TENANT_ID: 1
TENANT_NAME: sys
EFFECTIVE_TENANT_ID: 1002
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: START TRANSACTION
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:
P1TEXT:
P1: 0
P2TEXT:
P2: 0
P3TEXT:
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: 0
IS_INNER_SQL: 1
IS_EXECUTOR_RPC: 0
IS_HIT_PLAN: 0
REQUEST_TIME: 1722927382013329
ELAPSED_TIME: 85
NET_TIME: 0
NET_WAIT_TIME: 0
QUEUE_TIME: 0
DECODE_TIME: 0
GET_PLAN_TIME: 72
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: 131072
EXPECTED_WORKER_COUNT: 0
USED_WORKER_COUNT: 0
SCHED_INFO: NULL
FUSE_ROW_CACHE_HIT: 0
PS_CLIENT_STMT_ID: -1
PS_INNER_STMT_ID: -1
TX_ID: 274583
SNAPSHOT_VERSION: 0
REQUEST_TYPE: 1
IS_BATCHED_MULTI_STMT: 0
OB_TRACE_INFO: NULL
PLAN_HASH: 0
LOCK_FOR_READ_TIME: 0
PARAMS_VALUE:
RULE_NAME:
PARTITION_HIT: 1
TX_INTERNAL_ROUTING: 0
TX_STATE_VERSION: 0
FLT_TRACE_ID:
PL_TRACE_ID: NULL
PLSQL_EXEC_TIME: 0
TOTAL_MEMSTORE_READ_ROW_COUNT: 0
TOTAL_SSSTORE_READ_ROW_COUNT: 0
1 row in set