The DELETE_INDEX_STATS procedure deletes index-related statistics.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
DBMS_STATS.DELETE_INDEX_STATS (
ownname VARCHAR2,
indname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
cascade_parts BOOLEAN DEFAULT TRUE,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE,
tabname VARCHAR2 DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current logon username is used by default. |
| indname | The name of the index. |
| partname | The name of the partition. |
| cascade_parts | If the index is partitioned and partname is NULL, when you set this parameter to TRUE, the statistics on this index will be deleted from all underlying partitions. Default value: TRUE. |
| no_invalidate | Specifies whether to refresh the plan cache during statistics collection. If you set the value to TRUE, the plan cache will not be refreshed during statistics collection. |
| force | Specifies whether to perform forced deletion and ignore the lock status. Default value: FALSE. If you set the value to TRUE, index statistics will be deleted even if they are locked. |
| tabname | The name of the table. |
Exceptions
| Error code | Description |
|---|---|
| ORA-20000 | The object does not exist, or you do not have the required privileges. |
| ORA-20005 | Statistics on the object are locked. |
Considerations
To call this procedure, you must be the owner of the table. If the object is in the sys tenant, you must be the owner of the table or have the SYSDBA privilege.
Examples
Delete all statistics on the idx1 index in the tbl1 table of the testUser01 user.
obclient> CALL DBMS_STATS.DELETE_INDEX_STATS('testUser01', 'idx1', 'tbl1');
Query OK, 0 rows affected
Note
In the Oracle mode of OceanBase Database, you do not need to specify the tabname parameter because the index is unique under the current user. In the MySQL mode, you must specify the table name because indexes are not unique under the current user.