Edit

How to configure data retention in Fabric Data Warehouse

You can configure the data retention period for a warehouse in Microsoft Fabric. This retention period determines how far back in time you can perform time travel queries, create table clones, use restore points, and create warehouse snapshots.

Permissions

  • Any user who is a member of the Admin workspace role can configure the data retention period for a warehouse.
  • Users who are members of the Member, Contributor, or Viewer workspace roles can query the current retention setting but can't modify it.

Configure data retention by using T-SQL

You can configure the data retention period for a warehouse by using the ALTER DATABASE ... SET T-SQL syntax. You can use the SQL query editor in the Fabric portal or any T-SQL query tool to issue these commands. Specify the retention period in days between 1 and 120.

ALTER DATABASE CURRENT
SET TIME_TRAVEL_RETENTION_PERIOD = <number_of_days> DAYS;

To set the retention period to 15 days, use the following example:

ALTER DATABASE CURRENT
SET TIME_TRAVEL_RETENTION_PERIOD = 15 DAYS;

To set the retention period to 1 day, use the following example:

ALTER DATABASE CURRENT
SET TIME_TRAVEL_RETENTION_PERIOD = 1 DAYS;

Note

Only the Coordinated Universal Time (UTC) time zone is used for data retention calculations.

Check the current retention setting

You can check the current data retention setting by using the following T-SQL query on the sys.databases system catalog view:

SELECT 
   name, 
   time_travel_retention_period_days, 
   time_travel_retention_cutoff_date
FROM sys.databases;