The DELETE_COLUMN_STATS procedure is used to delete column-level statistics.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_STATS.DELETE_COLUMN_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
colname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
cascade_parts BOOLEAN DEFAULT TRUE,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE,
col_stat_type VARCHAR2 DEFAULT 'ALL');
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current logged-in username will be used by default. |
| tabname | The name of the table to which this column belongs. |
| colname | The column name or extension. |
| partname | The name of the partition where the statistics are stored. If the table is partitioned and partname is NULL, the statistics are stored at the global table level. |
| cascade_parts | Whether to also delete statistics at the partition and subpartition levels. The default value is TRUE. |
| no_invalidate | Whether to invalidate the Plan Cache when collecting statistics. If set to TRUE, the Plan Cache will not be invalidated when collecting statistics. |
| force | Whether to forcibly collect statistics and ignore lock status. The default value is FALSE. If set to TRUE, statistics will be collected even if they are locked. |
| col_stat_type | The type of column-level statistics to delete. The valid values are as follows:
|
Exceptions
| Error code | Description |
|---|---|
| OBE-20000 | The object does not exist or the user does not have sufficient privileges. |
| OBE-20005 | The statistics for the object are locked. |
Considerations
To call this procedure, you must be the owner of the table. For objects in the SYS tenant, you must be the owner of the table or have the SYSDBA privilege to call this procedure.
Examples
Delete all statistics for the col1 column in the tbl1 table of the testUser01 user.
obclient> CALL DBMS_STATS.DELETE_COLUMN_STATS('testUser01', 'tbl1', 'col1',col_stat_type=>'ALL');
Query OK, 0 rows affected
