0

I enabled change tracking in my database Trans and table Employee

ALTER DATABASE [Trans]
SET CHANGE_TRACKING = ON
( CHANGE_RETENTION = 5 MINUTES , AUTO_CLEANUP = ON)

ALTER TABLE [Employee]
ENABLE CHANGE_TRACKING
WITH ( TRACK_COLUMNS_UPDATED = OFF )

I did some update in my employee tables then check data in change tracking

SELECT * FROM CHANGETABLE(CHANGES [Employee], 0) AS ETbl

It show data which has changed. I know that cleanup process is asynchronous so I waited for a bit longer than the retention period (lets say 8 Minutes). I still get the result with the query. Cleanup process is executing after 2 days.

I have searched online about it

Change Tracking Auto Cleanup doesn't work

Change Tracking cleanup

but not found proper answer.

Community
  • 1
  • 1

1 Answers1

1

Change Tracking auto cleanup is a background thread that wakes up every 30 minutes and will iterate over the list of tables that are enabled for change tracking.

It will cleanup the expired records from corresponding side tables. It identifies the expired records based on the retention period that you have configured when you enabled change tracking on the database. The default is 2 days which means every time it will cleanup those records in your side table which are more than 2 days old.

Madhan Kumar
  • 121
  • 7