Note
This view is available starting with V4.2.0.
Purpose
This view displays the number of DML operations performed on each table since the last statistics collection and whether the current statistics are stale.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| DATABASE_NAME | varchar(128) | NO | The name of the database where the table is located. |
| TABLE_NAME | varchar(128) | NO | The name of the table. |
| PARTITION_NAME | varchar(128) | YES | The name of the partition. If the value of this column is NULL for a partitioned table, it indicates that the record is aggregated at the table level. |
| SUBPARTITION_NAME | varchar(128) | YES | The name of the subpartition. If the value of this column is NULL for a subpartitioned table, it indicates that the record is aggregated at the table level or the partition level. |
| LAST_ANALYZED_ROWS | bigint(20) | YES | The number of rows when the statistics were last collected. If the value is NULL, it indicates that no statistics have been collected. |
| LAST_ANALYZED_TIME | timestamp(6) | YES | The time when the statistics were last collected. If the value is NULL, it indicates that no statistics have been collected. |
| INSERTS | bigint(21) | NO | The number of rows inserted since the last statistics collection. |
| UPDATES | bigint(21) | NO | The number of rows updated since the last statistics collection. |
| DELETES | bigint(21) | NO | The number of rows deleted since the last statistics collection. |
| STALE_PERCENT | bigint(21) | NO | The percentage used to determine if the statistics are stale. |
| IS_STALE | varchar(3) | NO | Indicates whether the statistics are stale.
|
Sample query
Query the number of DDL operations performed on the t_subpart table in the current tenant since the last statistics collection and the staleness 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
