The OceanBase Database optimizer supports the following statistics collection methods. It also provides views for querying collected statistics.
Manual statistics collection: You can collect statistics by using the
DBMS_STATSsystem package or anANALYZEstatement. For more information, see Manual statistics collection.Automatic statistics collection: The system periodically collects missing or stale statistics through maintenance windows. For more information, see Automatic statistics collection.
Online statistics collection: The system collects statistics during a bulk data load. For more information, see Online statistics collection.
Asynchronous statistics collection: The system periodically checks data changes in tables or partitions to promptly process tables or partitions whose data has changed significantly. For more information, see Asynchronous statistics collection.
OceanBase Database provides views compatible with Oracle Database for querying collected statistics in Oracle-compatible mode. The following table describes these views.
View name |
Description |
|---|---|
ALL_TAB_STATISTICS, DBA_TAB_STATISTICS, and USER_TAB_STATISTICS |
Displays table-level statistics. |
ALL_TAB_COL_STATISTICS, DBA_TAB_COL_STATISTICS, and USER_TAB_COL_STATISTICS |
Displays GLOBAL-level column statistics. |
ALL_PART_COL_STATISTICS, DBA_PART_COL_STATISTICS, and USER_PART_COL_STATISTICS |
Displays PARTITION-level column statistics. |
ALL_SUBPART_COL_STATISTICS, DBA_SUBPART_COL_STATISTICS, and USER_SUBPART_COL_STATISTICS |
Displays SUBPARTITION-level column statistics. |
ALL_TAB_HISTOGRAMS, DBA_TAB_HISTOGRAMS, and USER_TAB_HISTOGRAMS |
Displays GLOBAL-level column histogram statistics. |
ALL_PART_HISTOGRAMS, DBA_PART_HISTOGRAMS, and USER_PART_HISTOGRAMS |
Displays PARTITION-level column histogram statistics. |
ALL_SUBPART_HISTOGRAMS, DBA_SUBPART_HISTOGRAMS, and USER_SUBPART_HISTOGRAMS |
Displays SUBPARTITION-level column histogram statistics. |
ALL_IND_STATISTICS, DBA_IND_STATISTICS, and USER_IND_STATISTICS |
Displays index statistics. |
sys.ALL_VIRTUAL_TABLE_STAT_REAL_AGENT |
Agent table for querying table-level statistics. |
sys.ALL_VIRTUAL_COLUMN_STAT_REAL_AGENT |
Agent table for querying basic column-level statistics. |
sys.ALL_VIRTUAL_HISTOGRAM_STAT_REAL_AGENT |
Agent table for querying column-level histogram information. |
The following table describes the views for querying statistics in MySQL-compatible mode of OceanBase Database.
View name |
Description |
|---|---|
oceanbase.DBA_TAB_STATISTICS |
Displays table-level statistics. |
oceanbase.DBA_TAB_COL_STATISTICS |
Displays GLOBAL-level column statistics. |
oceanbase.DBA_PART_COL_STATISTICS |
Displays PARTITION-level column statistics. |
oceanbase.DBA_SUBPART_COL_STATISTICS |
Displays SUBPARTITION-level column statistics. |
oceanbase.DBA_TAB_HISTOGRAMS |
Displays GLOBAL-level column histogram statistics. |
oceanbase.DBA_PART_HISTOGRAMS |
Displays PARTITION-level column histogram statistics. |
oceanbase.DBA_SUBPART_HISTOGRAMS |
Displays SUBPARTITION-level column histogram statistics. |
oceanbase.DBA_IND_STATISTICS |
Displays index statistics. |