Performance issues when CompactClientDataAgent is started

If the Core.ClientData SQL table contains a large amount of data, CompactClientDataAgent is not able to clean all of it at once. This is because SQL Server calls a Table Lock when the ClientDataStore.CompactData method tries to delete more than 5000 records. This leads to accumulating of obsolete entities in the table, which causes Sitecore XP instance performance issues.