Note
This view is available starting with V1.4.
Purpose
This view displays the current or previous wait events of all sessions of all tenants on the current OBServer node. By convention, each wait event has three parameters, each of which records the corresponding value.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| SID | bigint(20) | NO | For V4.2.x:
|
| CON_ID | bigint(20) | NO | The tenant ID. |
| SVR_IP | varchar(46) | NO | The IP address of the server. |
| SVR_PORT | bigint(20) | NO | The port of the server. |
| EVENT | varchar(64) | NO | The name of the wait event. |
| P1TEXT | varchar(64) | NO | The description of the first parameter of the wait event. |
| P1 | bigint(20) unsigned | NO | The value of the first parameter of the wait event. |
| P2TEXT | varchar(64) | NO | The description of the second parameter of the wait event. |
| P2 | bigint(20) unsigned | NO | The value of the second parameter of the wait event. |
| P3TEXT | varchar(64) | NO | The description of the third parameter of the wait event. |
| P3 | bigint(20) unsigned | NO | The value of the third parameter of the wait event. |
| WAIT_CLASS_ID | bigint(20) | NO | The ID of the wait event category. |
| WAIT_CLASS# | bigint(20) | NO | The sequence number of the wait event category. |
| WAIT_CLASS | varchar(64) | NO | The name of the wait event category. |
| STATE | varchar(19) | NO | The state of the current wait event. Valid values: |
| WAIT_TIME_MICRO | bigint(20) | NO | The wait time in microseconds. If the session is currently waiting, this column indicates the time that has elapsed since the session started waiting. If the session is not currently waiting, this column indicates the total wait time of the last wait. |
| TIME_REMAINING_MICRO | bigint(20) | NO | |
| TIME_SINCE_LAST_WAIT_MICRO | bigint(20) | NO | The time elapsed since the last wait ended, in microseconds. If the session is currently waiting, this column is 0. |
Sample query
Query the current or previous wait events of all sessions of all tenants on the current node in the sys tenant, and display the first two records.
obclient [oceanbase]> SELECT * FROM oceanbase.V$SESSION_WAIT LIMIT 2\G
The query result is as follows:
*************************** 1. row ***************************
SID: 3221556516
CON_ID: 1
SVR_IP: 11.xxx.xxx.xxx
SVR_PORT: 28825
EVENT: exec inner sql wait
P1TEXT: wait inner sql class
P1: 0
P2TEXT: inner session id
P2: 9223372037041368750
P3TEXT:
P3: 0
WAIT_CLASS_ID: 100
WAIT_CLASS#: 0
WAIT_CLASS: OTHER
STATE: WAITED SHORT TIME
WAIT_TIME_MICRO: 10
TIME_REMAINING_MICRO: -1
TIME_SINCE_LAST_WAIT_MICRO: -98897888932428406
*************************** 2. row ***************************
SID: 3221561745
CON_ID: 1004
SVR_IP: 11.xxx.xxx.xxx
SVR_PORT: 28825
EVENT: wait in request queue
P1TEXT: pcode
P1: 0
P2TEXT: level
P2: 0
P3TEXT: priority
P3: 0
WAIT_CLASS_ID: 102
WAIT_CLASS#: 2
WAIT_CLASS: CONFIGURATION
STATE: WAITED SHORT TIME
WAIT_TIME_MICRO: 18
TIME_REMAINING_MICRO: -1
TIME_SINCE_LAST_WAIT_MICRO: -98896269294038500
2 rows in set
References
To query all wait events at the session level:
- For more information about wait events, see Common wait events.