Note
This view is introduced since OceanBase Database V4.0.0.
Purpose
The oceanbase.DBA_SQL_PLAN_BASELINES view displays the SQL plan baselines in SQL Plan Management (SPM).
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| SIGNATURE | bigint(20) unsigned | NO | The SQL unique identifier generated by the normalized SQL statement. |
| SQL_HANDLE | varchar(32) | NO | The unique SQL text. |
| SQL_TEXT | longtext | NO | The unnormalized SQL text. |
| PLAN_NAME | varchar(128) | NO | The unique plan identifier in the text form. |
| CREATOR | varchar(128) | NO | The user who created the plan baseline. |
| ORIGIN | varchar(29) | NO | The way that the plan baseline was created. Valid values: |
| PARSING_SCHEMA_NAME | varchar(128) | NO | At present, this column is not supported and is NULL by default. |
| DESCRIPTION | varchar(500) | YES | The description of the plan baseline. |
| VERSION | varchar(256) | NO | The database version at the time when the plan baseline was created. |
| CREATED | timestamp(6) | YES | The time when the plan baseline was created. |
| LAST_MODIFIED | timestamp(6) | YES | The time when the plan baseline was modified the last time. |
| LAST_EXECUTED | bigint(20) | NO | The time when the plan baseline was executed the last time. |
| LAST_VERIFIED | bigint(20) | NO | The time when the plan baseline was verified the last time. |
| ENABLED | varchar(3) | NO | Indicates whether the plan baseline is enabled. Valid values: |
| ACCEPTED | varchar(3) | NO | Indicates whether the plan baseline is adopted. Valid values: |
| FIXED | varchar(3) | NO | Indicates whether the plan baseline is fixed. Valid values: |
| REPRODUCED | varchar(3) | NO | Indicates whether the plan baseline is reproducible. Valid values: |
| AUTOPURGE | varchar(3) | NO | Indicates whether the plan baseline is subject to automatic cleanup. Valid values: |
| ADAPTIVE | varchar(3) | NO | Indicates whether the plan baseline automatically captured by the SPM has been adapted. Valid values: |
| OPTIMIZER_COST | bigint(20) | NO | The plan cost estimated by the optimizer when the plan baseline was created. |
| MODULE | varchar(64) | NO | At present, this column is not supported and is NULL by default. |
| ACTION | varchar(64) | NO | At present, this column is not supported and is NULL by default. |
| EXECUTIONS | bigint(20) | NO | The number of times when the plan had been executed since the plan baseline was created. |
| ELAPSED_TIME | bigint(20) | NO | The total time consumed for the plan since the plan baseline was created. |
| CPU_TIME | bigint(20) | NO | The total CPU time consumed by the plan since the plan baseline was created. |
| BUFFER_GETS | bigint(0) | NO | At present, this column is not supported and is NULL by default. |
| DISK_READS | bigint(0) | NO | At present, this column is not supported and is NULL by default. |
| DIRECT_WRITES | bigint(0) | NO | At present, this column is not supported and is NULL by default. |
| ROWS_PROCESSED | bigint(0) | NO | At present, this column is not supported and is NULL by default. |
| FETCHES | bigint(0) | NO | At present, this column is not supported and is NULL by default. |
| END_OF_FETCH_COUNT | bigint(0) | NO | At present, this column is not supported and is NULL by default. |
Sample query
Query the SQL plan baselines in the SPM of the current tenant.
obclient[oceanbase]> SELECT * FROM oceanbase.DBA_SQL_PLAN_BASELINES\G
The query result is as follows:
*************************** 1. row ***************************
SIGNATURE: 6055243608786114737
SQL_HANDLE: 7F31B924FE5B551C798869E33EA756E6
SQL_TEXT: SELECT * FROM oceanbase.DBA_OB_SPM_EVO_RESULT
PLAN_NAME: 6055243608786114737
CREATOR: oceanbase
ORIGIN: AUTO-CAPTURE
PARSING_SCHEMA_NAME: NULL
DESCRIPTION: NULL
VERSION: 4.3.5.3
CREATED: 2025-04-28 11:47:03.099080
LAST_MODIFIED: 2025-04-28 11:47:03.099080
LAST_EXECUTED: 1745812023098177
LAST_VERIFIED: 1745812023098177
ENABLED: YES
ACCEPTED: YES
FIXED: NO
REPRODUCED: YES
AUTOPURGE: YES
ADAPTIVE: NO
OPTIMIZER_COST: -1
MODULE: NULL
ACTION: NULL
EXECUTIONS: 1
ELAPSED_TIME: 33980
CPU_TIME: 4010
BUFFER_GETS: NULL
DISK_READS: NULL
DIRECT_WRITES: NULL
ROWS_PROCESSED: NULL
FETCHES: NULL
END_OF_FETCH_COUNT: NULL
*************************** 2. row ***************************
SIGNATURE: 17903725222469937441
SQL_HANDLE: BAD211D504FC6E9265F28CFB3CAEF7C9
SQL_TEXT: SELECT sql_handle,plan_name FROM oceanbase.DBA_SQL_PLAN_BASELINES
PLAN_NAME: 17903725222469937441
CREATOR: info
ORIGIN: AUTO-CAPTURE
PARSING_SCHEMA_NAME: NULL
DESCRIPTION: NULL
VERSION: 4.3.5.3
CREATED: 2025-04-28 11:44:16.537033
LAST_MODIFIED: 2025-04-28 11:44:16.537033
LAST_EXECUTED: 1745811856535817
LAST_VERIFIED: 1745811856535817
ENABLED: YES
ACCEPTED: YES
FIXED: NO
REPRODUCED: YES
AUTOPURGE: YES
ADAPTIVE: NO
OPTIMIZER_COST: -1
MODULE: NULL
ACTION: NULL
EXECUTIONS: 1
ELAPSED_TIME: 12067
CPU_TIME: 239
BUFFER_GETS: NULL
DISK_READS: NULL
DIRECT_WRITES: NULL
ROWS_PROCESSED: NULL
FETCHES: NULL
END_OF_FETCH_COUNT: NULL
*************************** 3. row ***************************
SIGNATURE: 12843576483891728377
SQL_HANDLE: C25B16E757E1DEF0EC45BCF0B758D69F
SQL_TEXT: SELECT * FROM t1 WHERE c1 > 1
PLAN_NAME: 12843576483891728377
CREATOR: info
ORIGIN: AUTO-CAPTURE
PARSING_SCHEMA_NAME: NULL
DESCRIPTION: NULL
VERSION: 4.3.5.3
CREATED: 2025-04-28 11:44:09.870337
LAST_MODIFIED: 2025-04-28 11:44:09.870337
LAST_EXECUTED: 1745811849867388
LAST_VERIFIED: 1745811849867388
ENABLED: YES
ACCEPTED: YES
FIXED: NO
REPRODUCED: YES
AUTOPURGE: YES
ADAPTIVE: NO
OPTIMIZER_COST: -1
MODULE: NULL
ACTION: NULL
EXECUTIONS: 1
ELAPSED_TIME: 20769
CPU_TIME: 100
BUFFER_GETS: NULL
DISK_READS: NULL
DIRECT_WRITES: NULL
ROWS_PROCESSED: NULL
FETCHES: NULL
END_OF_FETCH_COUNT: NULL
*************************** 4. row ***************************
SIGNATURE: 2205174570288151559
SQL_HANDLE: D6A97DD0EA1661D4A003AA4AA979B816
SQL_TEXT: SELECT SQL_ID, PLAN_HASH FROM oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT WHERE QUERY_SQL LIKE '%SELECT * FROM test_table WHERE value = 100%'
PLAN_NAME: 2205174570288151559
CREATOR: info
ORIGIN: MANUAL-LOAD
PARSING_SCHEMA_NAME: NULL
DESCRIPTION: NULL
VERSION: 4.3.5.3
CREATED: 2025-04-28 14:51:35.457988
LAST_MODIFIED: 2025-04-28 14:51:35.457988
LAST_EXECUTED: 1745821885403901
LAST_VERIFIED: 1745821885403901
ENABLED: YES
ACCEPTED: YES
FIXED: YES
REPRODUCED: YES
AUTOPURGE: YES
ADAPTIVE: NO
OPTIMIZER_COST: -1
MODULE: NULL
ACTION: NULL
EXECUTIONS: 1
ELAPSED_TIME: 33556
CPU_TIME: 33535
BUFFER_GETS: NULL
DISK_READS: NULL
DIRECT_WRITES: NULL
ROWS_PROCESSED: NULL
FETCHES: NULL
END_OF_FETCH_COUNT: NULL
4 rows in set
References
To view the configuration parameters in the SPM of the current tenant, see DBA_SQL_MANAGEMENT_CONFIG.
For more information about the SPM evolution mechanism, see Execution plan management.