Note
This view is available starting with V4.0.0.
Overview
The system tenant displays column statistics and histogram information for all tenants.
Columns
Field Name |
Type |
Nullable |
Description |
|---|---|---|---|
| CON_ID | bigint(20) | NO | Tenant ID |
| OWNER | varchar(128) | NO | Database (MySQL-compatible mode) or user (Oracle-compatible mode) to which the column belongs |
| TABLE_NAME | varchar(128) | NO | Table name of the column |
| COLUMN_NAME | varchar(128) | NO | Column name |
| NUM_DISTINCT | bigint(20) | NO | Number of distinct values in the column |
| LOW_VALUE | varchar(128) | NO | Minimum value of the column |
| HIGH_VALUE | varchar(128) | NO | Maximum value of the column |
| DENSITY | bigint(21) | NO | Column Density |
| NUM_NULLS | bigint(20) | NO | In the columnNULLNumber of Values |
| NUM_BUCKETS | bigint(20) | NO | Number of Buckets in a Column Histogram |
| LAST_ANALYZED | date | NO | Last Analysis Time |
| SAMPLE_SIZE | bigint(20) | NO | Sample size for analysis |
| GLOBAL_STATS | varchar(3) | NO |
|
| USER_STATS | varchar(3) | NO | Whether partition statistics are user-defined |
| NOTES | varchar(80) | NO | Record some additional attributes |
| AVG_COL_LEN | bigint(21) | NO | Average Column Length |
| HISTOGRAM | varchar(15) | NO | Histogram type |
| SCOPE | varchar(7) | NO | Validity period of statistics |
Sample query
In the sys tenant, query the column statistics and histogram information of table T2_M_LR for the tenant with ID 1004.
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
View statistics of the current tenant: DBA_TAB_COL_STATISTICS
For information about how to collect statistics, see the following topics:
