Note
This view is available starting with V4.0.0.
Overview
Displays the overall status of each plan cache for all tenants on the current OBServer node.
Columns
Field Name |
Type |
Whether can be NULL |
Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | Tenant ID |
| SVR_IP | varchar(46) | NO | Server IP Address |
| SVR_PORT | bigint(20) | NO | Server Port Number |
| SQL_NUM | bigint(20) | NO | Number of SQL Statements Involved in Plan Cache |
| MEM_USED | bigint(20) | NO | Memory Used by Plan Cache, in Bytes |
| MEM_HOLD | bigint(20) | NO | Memory Held by Plan Cache, in Bytes |
| ACCESS_COUNT | bigint(20) | NO | Number of Queries Accessing Plan Cache |
| HIT_COUNT | bigint(20) | NO | Number of Hits in Plan Cache |
| HIT_RATE | bigint(20) | NO | Plan Cache Hit Rate |
| PLAN_NUM | bigint(20) | NO | Number of Plans |
| MEM_LIMIT | bigint(20) | NO | The maximum memory for the plan cache, in bytes. |
| HASH_BUCKET | bigint(20) | NO | Number of Buckets in Plan Cache Hash Map |
| STMTKEY_NUM | bigint(20) | NO | Number of stmt_keys in plan_cache |
Sample query
In the sys tenant, view the overall status of the plan cache for all tenants on the current node.
obclient [oceanbase]> SELECT * FROM oceanbase.V$OB_PLAN_CACHE_STAT;
The query result is as follows:
+-----------+----------------+----------+---------+------------+-----------+--------------+-----------+----------+----------+-----------+-------------+-------------+
| TENANT_ID | SVR_IP | SVR_PORT | SQL_NUM | MEM_USED | MEM_HOLD | ACCESS_COUNT | HIT_COUNT | HIT_RATE | PLAN_NUM | MEM_LIMIT | HASH_BUCKET | STMTKEY_NUM |
+-----------+----------------+----------+---------+------------+-----------+--------------+-----------+----------+----------+-----------+-------------+-------------+
| 1 | 11.xxx.xxx.xxx | 28825 | 384 | -487905874 | 136499200 | 42021468 | 41992690 | 99 | 384 | 161061270 | 49157 | 0 |
| 1001 | 11.xxx.xxx.xxx | 28825 | 198 | -563197122 | 47575040 | 23670865 | 23639306 | 99 | 198 | 53687090 | 49157 | 0 |
| 1002 | 11.xxx.xxx.xxx | 28825 | 460 | 5760423 | 75497472 | 4827477 | 4824011 | 99 | 460 | 214748360 | 49157 | 0 |
| 1003 | 11.xxx.xxx.xxx | 28825 | 133 | -584950706 | 41943040 | 23666690 | 23632729 | 99 | 133 | 53687090 | 49157 | 0 |
| 1004 | 11.xxx.xxx.xxx | 28825 | 476 | 12579810 | 88080384 | 5379951 | 5376122 | 99 | 476 | 214748360 | 49157 | 0 |
| 1005 | 11.xxx.xxx.xxx | 28825 | 157 | -546030763 | 33554432 | 22703483 | 22673958 | 99 | 157 | 53687090 | 49157 | 0 |
| 1006 | 11.xxx.xxx.xxx | 28825 | 348 | -840236 | 60817408 | 4629583 | 4626530 | 99 | 348 | 214748360 | 49157 | 0 |
+-----------+----------------+----------+---------+------------+-----------+--------------+-----------+----------+----------+-----------+-------------+-------------+
7 rows in set
