Note
This view is available starting with V4.0.0.
Purpose
This view displays the column statistics and histogram information of all tenants under the sys tenant.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| CON_ID | bigint(20) | NO | The tenant ID. |
| OWNER | varchar(128) | NO | The user to whom the column belongs. |
| TABLE_NAME | varchar(128) | NO | The name of the table to which the column belongs. |
| COLUMN_NAME | varchar(128) | NO | The name of the column. |
| NUM_DISTINCT | bigint(20) | 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 | bigint(21) | NO | The density of the column. |
| NUM_NULLS | bigint(20) | NO | The number of NULL values in the column. |
| NUM_BUCKETS | bigint(20) | NO | The number of buckets in the histogram of the column. |
| LAST_ANALYZED | date | NO | The last time when statistics were collected. |
| SAMPLE_SIZE | bigint(20) | NO | The sampling size when statistics were collected. |
| GLOBAL_STATS | varchar(3) | NO | YES: indicates that statistics are directly collected or incrementally maintained.NO: other cases. |
| USER_STATS | varchar(3) | NO | Indicates whether the partition statistics are user-defined. |
| NOTES | varchar(80) | NO | Stores additional attributes. |
| AVG_COL_LEN | bigint(21) | NO | The average length of the column. |
| HISTOGRAM | varchar(15) | NO | The histogram type. |
| SCOPE | varchar(7) | NO | The scope of statistics. |
Sample query
Query the column statistics and histogram information of the T2_M_LR table in the tenant with ID 1004 under the sys tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_TAB_COL_STATISTICS WHERE CON_ID=1004 AND TABLE_NAME='T2_M_LR'\G
The query result is as follows:
*************************** 1. row ***************************
CON_ID: 1004
OWNER: SYS
TABLE_NAME: T2_M_LR
COLUMN_NAME: COL1
NUM_DISTINCT: 0
LOW_VALUE: NULL
HIGH_VALUE: NULL
DENSITY: 0
NUM_NULLS: 0
NUM_BUCKETS: 0
LAST_ANALYZED: 2025-03-12
SAMPLE_SIZE: 0
GLOBAL_STATS: NO
USER_STATS: NO
NOTES: NULL
AVG_COL_LEN: 0
HISTOGRAM: NULL
SCOPE: NULL
*************************** 2. row ***************************
CON_ID: 1004
OWNER: SYS
TABLE_NAME: T2_M_LR
COLUMN_NAME: COL2
NUM_DISTINCT: 0
LOW_VALUE: NULL
HIGH_VALUE: NULL
DENSITY: 0
NUM_NULLS: 0
NUM_BUCKETS: 0
LAST_ANALYZED: 2025-03-12
SAMPLE_SIZE: 0
GLOBAL_STATS: NO
USER_STATS: NO
NOTES: NULL
AVG_COL_LEN: 0
HISTOGRAM: NULL
SCOPE: NULL
2 rows in set
References
DBA_TAB_COL_STATISTICS: View the statistics of the current tenant.
For more information about how to collect statistics, see the following topics: