Note
This view is introduced since OceanBase Database V3.2.1.
Purpose
The USER_TAB_STATS_HISTORY view displays the statistics change history of all tables owned by the current user.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| TABLE_NAME | VARCHAR2(128) | NO | The name of the table. |
| PARTITION_NAME | VARCHAR2(128) | YES | The name of the partition. |
| SUBPARTITION_NAME | VARCHAR2(128) | YES | The name of the subpartition. |
| STATS_UPDATE_TIME | TIMESTAMP(6) WITH TIME ZONE | YES | The time when the statistics were updated. |
Sample query
Query the modification history of table statistics for table T_SUBPART in the current user's tables.
obclient [SYS]> SELECT * FROM SYS.USER_TAB_STATS_HISTORY WHERE TABLE_NAME='T_SUBPART';
The query result is as follows:
+------------+----------------+-------------------+-------------------------------------+
| TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | STATS_UPDATE_TIME |
+------------+----------------+-------------------+-------------------------------------+
| T_SUBPART | NULL | NULL | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P1 | NULL | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P2 | NULL | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P3 | NULL | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P1 | P1SP0 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P1 | P1SP1 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P1 | P1SP2 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P1 | P1SP3 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P2 | P2SP0 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P2 | P2SP1 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P2 | P2SP2 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P2 | P2SP3 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P3 | P3SP0 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P3 | P3SP1 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P3 | P3SP2 | 21-MAR-25 04.21.31.136013 PM +08:00 |
| T_SUBPART | P3 | P3SP3 | 21-MAR-25 04.21.31.136013 PM +08:00 |
+------------+----------------+-------------------+-------------------------------------+
16 rows in set
References
ALL_TAB_STATS_HISTORY: view the modification history of table statistics for all tables accessible to the current user.
DBA_TAB_STATS_HISTORY: view the modification history of table statistics for all tables in the current tenant.