Note
This view is introduced since OceanBase Database V4.0.0.
Purpose
The oceanbase.DBA_TAB_STATS_HISTORY view displays the history of the table 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 partitioned table. |
| SUBPARTITION_NAME | varchar(128) | NO | The name of the subpartitioned table. |
| STATS_UPDATE_TIME | datetime(6) | NO | The time when the statistics were updated. |
Sample query
View the table statistics modification history of the t_subpart table in the current tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_TAB_STATS_HISTORY WHERE TABLE_NAME='t_subpart';
The query result is as follows:
+-------+---------------+----------------+-------------------+----------------------------+
| OWNER | TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | STATS_UPDATE_TIME |
+-------+---------------+----------------+-------------------+----------------------------+
| test | t_subpart | NULL | NULL | 2025-03-21 15:23:11.884679 |
| test | t_subpart | NULL | NULL | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2023 | NULL | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2023 | NULL | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2024 | NULL | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2024 | NULL | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p_max | NULL | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2023 | p2023sp0 | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2023 | p2023sp0 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2023 | p2023sp1 | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2023 | p2023sp1 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2023 | p2023sp2 | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2023 | p2023sp2 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2023 | p2023sp3 | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2023 | p2023sp3 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2024 | p2024sp0 | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2024 | p2024sp0 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2024 | p2024sp1 | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2024 | p2024sp1 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2024 | p2024sp2 | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2024 | p2024sp2 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p2024 | p2024sp3 | 2025-03-21 15:23:11.884679 |
| test | t_subpart | p2024 | p2024sp3 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p_max | p_maxsp0 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p_max | p_maxsp1 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p_max | p_maxsp2 | 2025-03-21 16:21:09.868166 |
| test | t_subpart | p_max | p_maxsp3 | 2025-03-21 16:21:09.868166 |
+-------+---------------+----------------+-------------------+----------------------------+
27 rows in set