IMPORT_INDEX_STATS

2024-04-19 08:42:50  Updated

The IMPORT_INDEX_STATS procedure retrieves statistics on the specified index from the user statistics table and stores them in the dictionary.

Syntax

DBMS_STATS.IMPORT_INDEX_STATS (
  ownname       VARCHAR2,
  indname       VARCHAR2,
  partname      VARCHAR2 DEFAULT NULL,
  stattab       VARCHAR2,
  statown       VARCHAR2 DEFAULT NULL,
  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.
tabname The name of the table.
indname The name of the index.
partname The name of the partition. If the table is partitioned and partname is NULL, global statistics and partition column statistics are imported.
stattab The name of the user statistics table from which the statistics are retrieved.
statown The username of the user statistics table from which the statistics are retrieved.
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 import and ignore the lock status. Default value: FALSE. If you set the value to TRUE, index statistics will be imported even if they are locked.

Exceptions

Error code Description
HY000
  • The object does not exist, or you do not have the required privileges.
  • The values in the user statistics table are invalid or inconsistent.
  • Statistics on the object are locked.

Considerations

You cannot export or import statistics across databases that use different character sets.

Examples

Import and save the statistics on the idx1 index in the tbl1 table of the testUser01 user from the test_stat table to a dictionary.

obclient> CALL DBMS_STATS.CREATE_STAT_TABLE('testUser01', 'test_stat');
Query OK, 0 rows affected

obclient> CALL DBMS_STATS.IMPORT_INDEX_STATS('testUser01', 'idx1',stattab=>'test_stat',tabname=>'tbl1',no_invalidate=>FALSE);
Query OK, 0 rows affected

Note

In Oracle mode, you do not need to specify the tabname parameter because the index is unique under the current user. In MySQL mode, you must specify the table name because indexes are not unique under the current user.

Contact Us