Understanding OceanBase V3 and V4 Statistics Tables and Best Practices for Collecting Statistics
This article explains the differences between OceanBase V3 and V4 statistics storage, clarifies the optimal way to query V3 statistics for sys, MySQL, and Oracle tenants, and outlines the unified approach and recommended DBMS_STATS usage in V4.
In OceanBase V3 the system tables that store statistics are fragmented because merged daily statistics and manually collected statistics are kept separately, while V4 unifies the storage and stops daily merging of statistics.
Daily merge no longer collects statistics.
Both Oracle and MySQL tenants should use the DBMS_STATS package, which offers more parameters and flexibility than ANALYZE .
A scheduled JOB collects statistics daily for tables/partitions with data modification >10% and builds histograms for skewed columns.
1 V3 Version Statistics
The key points for V3 are summarized as follows:
Do not view statistics in the sys tenant; only merged statistics are visible, manual statistics are hidden.
MySQL tenant should query manual statistics via the tables __all_table_stat_v2 , __all_column_stat_v2 , and __all_histogram_stat_v2 .
Oracle tenant should query manual statistics via ALL_TAB_STATISTICS , ALL_TAB_COL_STATISTICS , and ALL_TAB_HISTOGRAMS .
System tables for the sys tenant:
System tables for the MySQL tenant:
System tables for the Oracle tenant (consistent with native Oracle):
2 V4 Version Statistics
In V4 the storage of statistics is largely unified, and it is recommended to view collected statistics in the business tenant.
Table‑level statistics:
Column‑level statistics:
Histogram statistics:
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.