IMPORT_COLUMN_STATS

2023-12-25 08:49:42  Updated

The IMPORT_COLUMN_STATS procedure imports column-level statistics.

Applicability

This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.

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 logon username is used by default.
tabname The name of the table to which the column belongs.
colname The name of the column.
partname The name of the table 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 when statistics are collected. If you set the value to TRUE, the plan cache is not refreshed when statistics are collected.
force Specifies whether to perform forced import and ignore the lock status. Default value: FALSE. If you set the value to TRUE, statistics will be imported even if they are locked.

Exceptions

Error code Description
ORA-20000 The object does not exist, or you do not have the required privileges.
ORA-20001 The values in the user statistics table are invalid or inconsistent.
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

Import the statistics on the col1 column in the tbl1 table of 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

Contact Us