oceanbase.CDB_TAB_COL_STATISTICS

2026-04-02 06:23:58  Updated

Note

This view is available starting with V4.0.0.

Purpose

This view displays the column statistics and histogram information of all tenants in the sys tenant.

Columns

Column Type Nullable Description
CON_ID bigint(20) NO The tenant ID
OWNER varchar(128) NO The user to which 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 time when the last analysis was performed
SAMPLE_SIZE bigint(20) NO The sampling size during the analysis
GLOBAL_STATS varchar(3) NO
  • YES: indicates that the statistics were collected directly or incrementally maintained.
  • NO: other cases
USER_STATS varchar(3) NO Indicates whether the partition statistics are user-defined.
NOTES varchar(80) NO Records some additional attributes
AVG_COL_LEN bigint(21) NO The average length of the column
HISTOGRAM varchar(15) NO The type of the histogram
SCOPE varchar(7) NO The scope of the statistics

Sample query

In the sys tenant, query the column statistics and histogram information of the T2_M_LR table in 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

Contact Us