📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

FUSE_TIME_TRAVEL_SIZE



Calculates the storage size of historical data (for Time Travel) for tables.

Syntax

-- Calculate historical data size for all tables in all databases SELECT ... FROM fuse_time_travel_size(); -- Calculate historical data size for all tables in a specified database SELECT ... FROM fuse_time_travel_size('<database_name>'); -- Calculate historical data size for a specified table in a specified database SELECT ... FROM fuse_time_travel_size('<database_name>', '<table_name>');

Output

The function returns a result set with the following columns:

ColumnDescription
database_nameThe name of the database where the table is located.
table_nameThe name of the table.
is_droppedIndicates whether the table has been dropped (true for dropped tables, false otherwise).
time_travel_sizeThe total storage size of historical data (for Time Travel) for the table, in bytes.
latest_snapshot_sizeThe storage size of the latest snapshot of the table, in bytes.
data_retention_period_in_hoursThe retention period for Time Travel data in hours (NULL means using the default retention policy).
errorAny error encountered while retrieving the storage size (NULL if no errors occurred).

Examples

This example calculates the historical data for all tables in the default database:

SELECT * FROM fuse_time_travel_size('default') ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ database_name │ table_name │ is_dropped │ time_travel_size │ latest_snapshot_size │ data_retention_period_in_hours │ error │ ├───────────────┼────────────┼────────────┼──────────────────┼──────────────────────┼────────────────────────────────┼──────────────────┤ │ default │ books │ true28101490NULLNULL │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Was this page helpful?