Note
This view is introduced since OceanBase Database V4.0.0.
Purpose
This view displays the histograms of all columns in tables in the current tenant.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| OWNER | varchar(128) | NO | The user who owns the histogram. |
| TABLE_NAME | varchar(128) | NO | The name of the table that owns the histogram. |
| COLUMN_NAME | varchar(128) | NO | The name of the column that owns the histogram. |
| ENDPOINT_NUMBER | decimal(10,0) | NO | The cumulative frequency of the bucket. |
| ENDPOINT_VALUE | decimal(10,0) | NO | The normalized value of the bucket endpoint. |
| ENDPOINT_ACTUAL_VALUE | text | NO | The value of the bucket endpoint. |
| ENDPOINT_ACTUAL_VALUE_RAW | text | NO | The binary value of the bucket endpoint. |
| ENDPOINT_REPEAT_COUNT | decimal(10,0) | NO | The frequency of the bucket endpoint value. |
| SCOPE | varchar(7) | NO | The scope of the histogram. |
Sample query
In the sys tenant, query the table-level histogram information of the t_subpart table in the current tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_TAB_HISTOGRAMS WHERE TABLE_NAME='t_subpart';
The query result is as follows:
+-------+------------+-------------+-----------------+----------------+-----------------------+---------------------------+-----------------------+-------+
| OWNER | TABLE_NAME | COLUMN_NAME | ENDPOINT_NUMBER | ENDPOINT_VALUE | ENDPOINT_ACTUAL_VALUE | ENDPOINT_ACTUAL_VALUE_RAW | ENDPOINT_REPEAT_COUNT | SCOPE |
+-------+------------+-------------+-----------------+----------------+-----------------------+---------------------------+-----------------------+-------+
| test | t_subpart | c1 | 1 | NULL | 0 | 04053F0000 | 1 | NULL |
| test | t_subpart | c1 | 2501 | NULL | 2500 | 04053F00C413 | 1 | NULL |
| test | t_subpart | c1 | 5001 | NULL | 5000 | 04053F008827 | 1 | NULL |
| test | t_subpart | c1 | 7501 | NULL | 7500 | 04053F00CC3A | 1 | NULL |
| test | t_subpart | c1 | 10000 | NULL | 9999 | 04053F008F4E | 1 | NULL |
| test | t_subpart | c2 | 10 | NULL | 0 | 04053F0000 | 10 | NULL |
| test | t_subpart | c2 | 2510 | NULL | 250 | 04053F00FA01 | 10 | NULL |
| test | t_subpart | c2 | 5010 | NULL | 500 | 04053F00F403 | 10 | NULL |
| test | t_subpart | c2 | 7510 | NULL | 750 | 04053F00EE05 | 10 | NULL |
| test | t_subpart | c2 | 10000 | NULL | 999 | 04053F00E707 | 10 | NULL |
| test | t_subpart | c3 | 5 | NULL | 0 | 04053F0000 | 5 | NULL |
| test | t_subpart | c3 | 2505 | NULL | 500 | 04053F00F403 | 5 | NULL |
| test | t_subpart | c3 | 5005 | NULL | 1000 | 04053F00E807 | 5 | NULL |
| test | t_subpart | c3 | 7505 | NULL | 1500 | 04053F00DC0B | 5 | NULL |
| test | t_subpart | c3 | 10000 | NULL | 1999 | 04053F00CF0F | 5 | NULL |
+-------+------------+-------------+-----------------+----------------+-----------------------+---------------------------+-----------------------+-------+
15 rows in set
References
To view the histogram statistics at the partition level: DBA_PART_HISTOGRAMS
To view the histogram statistics at the subpartition level: DBA_SUBPART_HISTOGRAMS
To view the column statistics at the table level: DBA_TAB_STATISTICS
To view the column statistics at the global level: DBA_TAB_COL_STATISTICS
To view the column statistics at the partition level: DBA_PART_COL_STATISTICS
To view the column statistics at the subpartition level: DBA_SUBPART_COL_STATISTICS
To view the index statistics: DBA_IND_STATISTICS
For more information about how to collect statistics, see the following topics: