The DELETE_TABLE_STATS procedure deletes table-level statistics.
Syntax
DBMS_STATS.DELETE_TABLE_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
cascade_parts BOOLEAN DEFAULT TRUE,
cascade_columns BOOLEAN DEFAULT TRUE,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE);
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current logon username is used by default. |
| tabname | The name of the table to which the column belongs. |
| partname | The name of the partition (subpartition) from which statistics are retrieved. If the table is partitioned and partname is NULL, statistics are retrieved at the global table level. |
| cascade_parts | Specifies whether to delete statistics at the partition level and the sub-partition level. Default value: TRUE. |
| cascade_columns | Specifies whether to delete statistics at the column level. 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 collection and ignore the lock status. Default value: FALSE. If you set the value to TRUE, statistics will be collected even if they are locked. |
Exceptions
| Error code | Description |
|---|---|
| HY000 |
|
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 tbl1 table of the testUser01 user.
obclient> CALL DBMS_STATS.DELETE_TABLE_STATS('testUser01', 'tbl1');
Query OK, 0 rows affected