Note
This view is available starting with V4.0.0.
Purpose
This view displays the column statistics and histogram information of all partitioned tables in the current tenant.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| OWNER | varchar(128) | NO | The owner of the partitioned table. |
| TABLE_NAME | varchar(128) | NO | The name of the table. |
| PARTITION_NAME | varchar(128) | NO | The name of the partition. |
| COLUMN_NAME | varchar(128) | NO | The name of the column. |
| NUM_DISTINCT | decimal(10,0) | NO | The number of distinct values in the column. |
| LOW_VALUE | varchar(128) | NO | The minimum value of the column. |
| HIGH_VALUE | varchar(128) | NO | The maximum value of the column. |
| DENSITY | decimal(10,0) | NO | The density of the column. If a histogram is available for the COLUMN_NAME column, this column displays the selectivity of values that span fewer than two endpoints in the histogram. It does not represent the selectivity of values that span two or more endpoints. If no histogram is available for the COLUMN_NAME column, the value of this column is 1/NUM_DISTINCT. |
| NUM_NULLS | decimal(10,0) | NO | The number of NULL values in the column. |
| NUM_BUCKETS | decimal(10,0) | NO | The number of buckets in the histogram of the column. |
| LAST_ANALYZED | datetime(6) | NO | The date when the column was last analyzed. |
| SAMPLE_SIZE | decimal(10,0) | NO | The sample size used for analyzing the column. |
| GLOBAL_STATS | varchar(3) | NO | Indicates whether statistics have been collected:
|
| NOTES | varchar(80) | NO | Describes some additional properties of the statistics:
This column can be used to determine whether the adaptive sampling format sketch has been fully invalidated and properly cleared. |
| AVG_COL_LEN | decimal(10,0) | NO | The average length of the column in bytes. |
| HISTOGRAM | varchar(15) | NO | Indicates the type of histogram:
|
Sample query
Query the column statistics and histogram information of the partitions of the t_subpart partitioned table in the current tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_PART_COL_STATISTICS WHERE TABLE_NAME='t_subpart';
The query result is as follows:
+-------+------------+----------------+-------------+--------------+-----------+------------+--------------+-----------+-------------+----------------------------+-------------+--------------+------------+-------+-------------+-----------+
| OWNER | TABLE_NAME | PARTITION_NAME | COLUMN_NAME | NUM_DISTINCT | LOW_VALUE | HIGH_VALUE | DENSITY | NUM_NULLS | NUM_BUCKETS | LAST_ANALYZED | SAMPLE_SIZE | GLOBAL_STATS | USER_STATS | NOTES | AVG_COL_LEN | HISTOGRAM |
+-------+------------+----------------+-------------+--------------+-----------+------------+--------------+-----------+-------------+----------------------------+-------------+--------------+------------+-------+-------------+-----------+
| test | t_subpart | p0 | c1 | 3540 | 0 | 9999 | 0.0002824859 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3334 | NO | NO | NULL | 20 | HYBRID |
| test | t_subpart | p0 | c2 | 1012 | 0 | 999 | 0.0009881423 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3334 | NO | NO | NULL | 20 | HYBRID |
| test | t_subpart | p0 | c3 | 2030 | 0 | 1999 | 0.0004926108 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3334 | NO | NO | NULL | 20 | HYBRID |
| test | t_subpart | p1 | c1 | 3308 | 1 | 9997 | 0.0003022975 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3333 | NO | NO | NULL | 20 | HYBRID |
| test | t_subpart | p1 | c2 | 1012 | 0 | 999 | 0.0009881423 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3333 | NO | NO | NULL | 20 | HYBRID |
| test | t_subpart | p1 | c3 | 2030 | 0 | 1999 | 0.0004926108 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3333 | NO | NO | NULL | 20 | HYBRID |
| test | t_subpart | p2 | c1 | 3230 | 2 | 9998 | 0.0003095975 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3333 | NO | NO | NULL | 20 | HYBRID |
| test | t_subpart | p2 | c2 | 1012 | 0 | 999 | 0.0009881423 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3333 | NO | NO | NULL | 20 | HYBRID |
| test | t_subpart | p2 | c3 | 2030 | 0 | 1999 | 0.0004926108 | 0 | 5 | 2025-03-17 15:30:30.152256 | 3333 | NO | NO | NULL | 20 | HYBRID |
+-------+------------+----------------+-------------+--------------+-----------+------------+--------------+-----------+-------------+----------------------------+-------------+--------------+------------+-------+-------------+-----------+
9 rows in set
References
Query column statistics at the table level: DBA_TAB_STATISTICS
Query column statistics at the global level: DBA_TAB_COL_STATISTICS
Query column statistics at the subpartition level: DBA_SUBPART_COL_STATISTICS
Query histogram statistics at the table level: DBA_TAB_HISTOGRAMS
Query histogram statistics at the partition level: DBA_PART_HISTOGRAMS
Query histogram statistics at the subpartition level: DBA_SUBPART_HISTOGRAMS
Query index statistics: DBA_IND_STATISTICS
For information about how to collect statistics, see the following topics:
