Note
This view is introduced since OceanBase Database V4.0.0.
Purpose
The GV$OB_PLAN_CACHE_STAT view displays the overall status of each plan cache on all OBServer nodes of all tenants.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | The ID of the tenant. |
| SVR_IP | varchar(46) | NO | The IP address of the OBServer node. |
| SVR_PORT | bigint(20) | NO | The port number of the OBServer node. |
| SQL_NUM | bigint(20) | NO | The number of SQL statements in the plan cache. |
| MEM_USED | bigint(20) | NO | The size of memory that the plan cache occupies. |
| MEM_HOLD | bigint(20) | NO | The size of memory that the plan cache holds. |
| ACCESS_COUNT | bigint(20) | NO | The number of times that the query accesses the plan cache. |
| HIT_COUNT | bigint(20) | NO | The number of plan cache hits. |
| HIT_RATE | bigint(20) | NO | The hit rate of the plan cache. |
| PLAN_NUM | bigint(20) | NO | The number of plans. |
| MEM_LIMIT | bigint(20) | NO | The maximum size of memory that the plan cache can occupy. |
| HASH_BUCKET | bigint(20) | NO | The number of buckets in the hash map of the plan cache. |
| STMTKEY_NUM | bigint(20) | NO | The number of stmt_keys in the plan cache. |
Sample query
In the sys tenant, query the overall plan cache status of all tenants across all nodes.
obclient [oceanbase]> SELECT * FROM oceanbase.GV$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 | 383 | -487995042 | 136499200 | 42006732 | 41977955 | 99 | 383 | 161061270 | 49157 | 0 |
| 1001 | 11.xxx.xxx.xxx | 28825 | 197 | -563375074 | 47575040 | 23662632 | 23631074 | 99 | 197 | 53687090 | 49157 | 0 |
| 1002 | 11.xxx.xxx.xxx | 28825 | 460 | 5760423 | 75497472 | 4825830 | 4822364 | 99 | 460 | 214748360 | 49157 | 0 |
| 1003 | 11.xxx.xxx.xxx | 28825 | 132 | -585128658 | 41943040 | 23658450 | 23624490 | 99 | 132 | 53687090 | 49157 | 0 |
| 1004 | 11.xxx.xxx.xxx | 28825 | 476 | 12579810 | 88080384 | 5378059 | 5374230 | 99 | 476 | 214748360 | 49157 | 0 |
| 1005 | 11.xxx.xxx.xxx | 28825 | 154 | -546485963 | 33554432 | 22695250 | 22665728 | 99 | 154 | 53687090 | 49157 | 0 |
| 1006 | 11.xxx.xxx.xxx | 28825 | 348 | -840236 | 60817408 | 4627947 | 4624894 | 99 | 348 | 214748360 | 49157 | 0 |
+-----------+----------------+----------+---------+------------+-----------+--------------+-----------+----------+----------+-----------+-------------+-------------+
7 rows in set