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 that display the statistics collection status in Oracle mode. The following table describes these views.
View |
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 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 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 | The agent table that displays table-level statistics. |
| sys.ALL_VIRTUAL_COLUMN_STAT_REAL_AGENT | The agent table that displays column-level basic statistics. |
| sys.ALL_VIRTUAL_HISTOGRAM_STAT_REAL_AGENT | The agent table that displays column-level histogram information. |
The following table describes the views that display statistics in the MySQL mode of OceanBase Database.
View |
Description |
|---|---|
| oceanbase.DBA_TAB_STATISTICS | Displays table-level statistics. |
| oceanbase.DBA_TAB_COL_STATISTICS | Displays global 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 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. |