Note
This view is available starting with V4.0.0.
Purpose
This view displays the optimizer statistics of all tables in the current tenant.
Columns
Column |
Type |
Nullable |
Description |
|---|---|---|---|
| OWNER | varchar(128) | NO | The owner of the object. |
| TABLE_NAME | varchar(128) | NO | The name of the table. |
| PARTITION_NAME | varchar(128) | NO | The name of the partition. |
| PARTITION_POSITION | decimal(10,0) | NO | The position of the partition in the table. |
| SUBPARTITION_NAME | varchar(128) | NO | The name of the subpartition. |
| SUBPARTITION_POSITION | decimal(10,0) | NO | The position of the subpartition in the partition. |
| OBJECT_TYPE | varchar(12) | NO | The type of the object. Valid values:
|
| NUM_ROWS | decimal(10,0) | NO | The number of rows in the object. |
| BLOCKS | decimal(10,0) | NO | The number of blocks used by the object. |
| EMPTY_BLOCKS | decimal(10,0) | NO | The number of empty blocks in the object. |
| AVG_SPACE | decimal(10,0) | NO | The average available space in the object. |
| CHAIN_CNT | decimal(10,0) | NO | The number of chained rows in the object. |
| AVG_ROW_LEN | decimal(10,0) | NO | The average row length, including row overhead. |
| AVG_SPACE_FREELIST_BLOCKS | decimal(10,0) | NO | The average available space for all blocks on the FREELIST. |
| NUM_FREELIST_BLOCKS | decimal(10,0) | NO | The number of blocks on the FREELIST. |
| AVG_CACHED_BLOCKS | decimal(10,0) | NO | The average number of blocks in the buffer cache. |
| AVG_CACHE_HIT_RATIO | decimal(10,0) | NO | The average cache hit ratio of the object. |
| IM_IMCU_COUNT | decimal(10,0) | NO | The number of in-memory compressed units (IMCUs) in the table. |
| IM_BLOCK_COUNT | decimal(10,0) | NO | The number of in-memory blocks in the table. |
| IM_STAT_UPDATE_TIME | datetime | NO | The timestamp when the statistics in memory were last updated. |
| SCAN_RATE | decimal(10,0) | NO | The scan rate of the object, in MB/s. |
| SAMPLE_SIZE | decimal(10,0) | NO | The sample size used for the table analysis. |
| LAST_ANALYZED | datetime(6) | NO | The date when the table was last analyzed. |
| GLOBAL_STATS | varchar(3) | NO | Indicates whether statistics are collected or incrementally maintained. Valid values:
|
| USER_STATS | varchar(3) | NO | Indicates whether statistics are directly input by users. Valid values:
|
| STATTYPE_LOCKED | varchar(5) | NO | The type of statistics lock. Valid values:
|
| STALE_STATS | varchar(3) | NO | Describes some additional attributes of the statistics. For example, the value STATS_ON_CONVENTIONAL_LOAD indicates that the statistics are collected by online statistics collection through conventional DML operations. |
| SCOPE | varchar(7) | NO | The value SHARED indicates that statistics are collected for tables other than global temporary tables. For global temporary tables, the value can be:
|
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 column statistics at the global level: DBA_TAB_COL_STATISTICS
View column statistics at the partition level: DBA_PART_COL_STATISTICS
View column statistics at the subpartition level: DBA_SUBPART_COL_STATISTICS
View histogram statistics at the table level: DBA_TAB_HISTOGRAMS
View histogram statistics at the partition level: DBA_PART_HISTOGRAMS
View histogram statistics at the subpartition level: DBA_SUBPART_HISTOGRAMS
View index statistics: DBA_IND_STATISTICS
For more information about how to collect statistics, see the following topics:
