The IMPORT_COLUMN_STATS procedure is used to import 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.IMPORT_COLUMN_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
colname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statown VARCHAR2 DEFAULT NULL,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE);
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current logged-in username is used by default. |
| tabname | The name of the table to which this column belongs. |
| colname | The column name. |
| partname | The name of the table partition. If the table is partitioned and partname is NULL, global and partition column statistics are imported. |
| stattab | The name of the user statistics table to import. |
| statown | The username of the user statistics table to import. |
| no_invalidate | Specifies whether to clear the Plan Cache when collecting statistics. If set to TRUE, the Plan Cache is not cleared when collecting statistics. |
| force | Specifies whether to forcibly import statistics and ignore lock status. Default is FALSE. If set to TRUE, statistics are imported even if they are locked. |
Exceptions
| Error code | Description |
|---|---|
| OBE-20000 | The object does not exist or the user does not have sufficient privileges. |
| OBE-20001 | The values in the user statistics table are invalid or inconsistent. |
| OBE-20005 | The statistics for the object are locked. |
Considerations
To call this procedure, you must be the owner of the table. For SYS-owned objects, you must be the owner or have the SYSDBA privilege to call this procedure.
Examples
Import the statistics for the col1 column of the tbl1 table in the testUser01 user from the test_stat table.
obclient> CALL DBMS_STATS.IMPORT_COLUMN_STATS ('testUser01', 'tbl1','col1',null, stattab=>'test_stat', statown=>'testUser01');
Query OK, 0 rows affected
