Note
This view is available starting with V4.0.0.
Overview
Displays optimizer statistics for all tables in the current tenant.
Columns
Field Name |
Type |
Whether can be NULL |
Description |
|---|---|---|---|
| OWNER | varchar(128) | NO | Owner of the object |
| TABLE_NAME | varchar(128) | NO | Table name |
| PARTITION_NAME | varchar(128) | NO | Partition Name |
| PARTITION_POSITION | decimal(10,0) | NO | Location of partitions in a table |
| SUBPARTITION_NAME | varchar(128) | NO | Subpartition name |
| SUBPARTITION_POSITION | decimal(10,0) | NO | The position of the subpartition within the partition. |
| OBJECT_TYPE | varchar(12) | NO | Object type:
|
| NUM_ROWS | decimal(10,0) | NO | Number of rows in the object |
| BLOCKS | decimal(10,0) | NO | Number of Blocks Used by the Object |
| EMPTY_BLOCKS | decimal(10,0) | NO | Number of Empty Blocks in the Object |
| AVG_SPACE | decimal(10,0) | NO | Average Available Space in Objects |
| CHAIN_CNT | decimal(10,0) | NO | Number of Linked Lines in Object |
| AVG_ROW_LEN | decimal(10,0) | NO | Average row length, including row overhead |
| AVG_SPACE_FREELIST_BLOCKS | decimal(10,0) | NO | Average Available Space of All Blocks on the FREELIST |
| NUM_FREELIST_BLOCKS | decimal(10,0) | NO | Number of Blocks on the FREELIST |
| AVG_CACHED_BLOCKS | decimal(10,0) | NO | Average Number of Blocks in Buffer Cache |
| AVG_CACHE_HIT_RATIO | decimal(10,0) | NO | Average Cache Hit Rate of Objects |
| IM_IMCU_COUNT | decimal(10,0) | NO | Number of IMCUs in the table |
| IM_BLOCK_COUNT | decimal(10,0) | NO | Number of In-Memory Blocks in the Table |
| IM_STAT_UPDATE_TIME | datetime | NO | Timestamp of the last update of statistics in memory |
| SCAN_RATE | decimal(10,0) | NO | Object Scan Rate (MB/s) |
| SAMPLE_SIZE | decimal(10,0) | NO | Sample size for table analysis |
| LAST_ANALYZED | datetime(6) | NO | Date of Last Table Analysis |
| GLOBAL_STATS | varchar(3) | NO | Specifies whether statistics are collected or incrementally maintained:
|
| USER_STATS | varchar(3) | NO | Specifies whether the statistics were directly entered by the user. Valid values:
|
| STATTYPE_LOCKED | varchar(5) | NO | Statistics Lock Type:
|
| STALE_STATS | varchar(3) | NO | Whether statistics are outdated |
| SCOPE | varchar(7) | NO | The SHARED value is used for statistics collected on any table except global temporary tables. For global temporary tables, the possible values are:
|
Sample query
Query the optimizer statistics of the t_subpart table in the current tenant.
obclient [oceanbase]> SELECT OWNER, TABLE_NAME, OBJECT_TYPE, NUM_ROWS, AVG_ROW_LEN FROM oceanbase.DBA_TAB_STATISTICS WHERE TABLE_NAME='t_subpart';
The query result is as follows:
+-------+------------+--------------+----------+-------------+
| OWNER | TABLE_NAME | OBJECT_TYPE | NUM_ROWS | AVG_ROW_LEN |
+-------+------------+--------------+----------+-------------+
| test | t_subpart | TABLE | 10000 | 60 |
| test | t_subpart | PARTITION | 3334 | 60 |
| test | t_subpart | PARTITION | 3333 | 60 |
| test | t_subpart | PARTITION | 3333 | 60 |
| test | t_subpart | SUBPARTITION | 1336 | 60 |
| test | t_subpart | SUBPARTITION | 999 | 60 |
| test | t_subpart | SUBPARTITION | 999 | 60 |
| test | t_subpart | SUBPARTITION | 1002 | 60 |
| test | t_subpart | SUBPARTITION | 1332 | 60 |
| test | t_subpart | SUBPARTITION | 999 | 60 |
| test | t_subpart | SUBPARTITION | 1002 | 60 |
| test | t_subpart | SUBPARTITION | 999 | 60 |
| test | t_subpart | SUBPARTITION | 1332 | 60 |
+-------+------------+--------------+----------+-------------+
13 rows in set
References
View global column statistics: DBA_TAB_COL_STATISTICS
View partition-level column statistics: DBA_PART_COL_STATISTICS
View column statistics at the subpartition level: DBA_SUBPART_COL_STATISTICS
View table-level histogram statistics: DBA_TAB_HISTOGRAMS
View partition-level histogram statistics: DBA_PART_HISTOGRAMS
View histogram statistics at the subpartition level: DBA_SUBPART_HISTOGRAMS
View index statistics: DBA_IND_STATISTICS
For information about how to collect statistics, see the following topics:
