Note
This view is available starting with V4.2.0.
Overview
Displays the number of DML operations performed on each table since the last statistics collection, and indicates whether the current statistics have expired.
Columns
Column |
Type |
Is NULL |
Description |
|---|---|---|---|
| DATABASE_NAME | varchar(128) | NO | The name of the database where the table is located. |
| TABLE_NAME | varchar(128) | NO | Table name |
| PARTITION_NAME | varchar(128) | YES | Partition name. When the value of this column in a partitioned table is NULL, it indicates that the current record is aggregated at the table level. |
| SUBPARTITION_NAME | varchar(128) | YES | Subpartition name. When the value of this column in a subpartitioned table is NULL, it indicates that the current record is aggregated at the table level or partition level. |
| LAST_ANALYZED_ROWS | bigint(20) | YES | The number of rows at the time of the last statistics collection. A value of NULL indicates that statistics have never been collected. |
| LAST_ANALYZED_TIME | timestamp(6) | YES | The time when statistics were last collected. A value of NULL indicates that statistics have never been collected. |
| INSERTS | bigint(21) | NO | How many rows were inserted since the last statistics collection? |
| UPDATES | bigint(21) | NO | How many rows have been updated since the last statistics collection? |
| DELETES | bigint(21) | NO | Number of rows deleted since the last statistics collection |
| STALE_PERCENT | bigint(21) | NO | Percentage of stale statistics |
| IS_STALE | varchar(3) | NO | Whether the statistics are expired.
|
Sample query
View the number of DML operations on the table t_subpart in the current tenant since the last statistics collection and the expiration status of the statistics.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_TABLE_STAT_STALE_INFO WHERE TABLE_NAME='t_subpart';
The query result is as follows:
+---------------+---------------+----------------+-------------------+--------------------+----------------------------+---------+---------+---------+---------------+----------+
| DATABASE_NAME | TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | LAST_ANALYZED_ROWS | LAST_ANALYZED_TIME | INSERTS | UPDATES | DELETES | STALE_PERCENT | IS_STALE |
+---------------+---------------+----------------+-------------------+--------------------+----------------------------+---------+---------+---------+---------------+----------+
| test | t_subpart | NULL | NULL | 1000 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2023 | NULL | 635 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2024 | NULL | 365 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p_max | NULL | 0 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2023 | p2023sp0 | 127 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2023 | p2023sp1 | 190 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2023 | p2023sp2 | 127 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2023 | p2023sp3 | 191 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2024 | p2024sp0 | 73 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2024 | p2024sp1 | 110 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2024 | p2024sp2 | 73 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p2024 | p2024sp3 | 109 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p_max | p_maxsp0 | 0 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p_max | p_maxsp1 | 0 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p_max | p_maxsp2 | 0 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
| test | t_subpart | p_max | p_maxsp3 | 0 | 2025-03-21 16:21:09.846859 | 0 | 0 | 0 | 10 | NO |
+---------------+---------------+----------------+-------------------+--------------------+----------------------------+---------+---------+---------+---------------+----------+
16 rows in set
