locked
Clear Tracking History on Server before a given date RRS feed

  • Question

  • I'm using SQL 2008 Server and SQL 2008 Express - when I provision the server it creates tracking tables.  I have a table which tracks stock updates and is updated hourly - there are currently 3,000 records in here and its associated tracking table has 77,000 records in it.

     

    Our devices drop all of their data every weekend and then do a sync from scratch.  This is  now taking a lot longer since the tracking tables have grown in size.

     

    Is there a way I can clear the tracking tables before a given date?  Looking at the table I think it would be something like:

    DELETE FROM Sync.stock_tracking WHERE sync_row_is tombstone=1 and last_change_datetime < DATE

     

    Has anyone tried something like this?


    • Edited by Harjit Samra Tuesday, August 30, 2011 11:01 AM Edit
    Tuesday, August 30, 2011 10:59 AM

Answers

  • use the metadata clean up API (SqlSyncStoreMetadataCleanup/SqlCeSyncStoreMetadataCleanup ) rather than executing SQL directly so the "knowledge" is updated as well rather than just deleting the tracking rows.

     

     

    • Marked as answer by Harjit Samra Tuesday, August 30, 2011 7:25 PM
    Tuesday, August 30, 2011 11:08 AM

All replies

  • use the metadata clean up API (SqlSyncStoreMetadataCleanup/SqlCeSyncStoreMetadataCleanup ) rather than executing SQL directly so the "knowledge" is updated as well rather than just deleting the tracking rows.

     

     

    • Marked as answer by Harjit Samra Tuesday, August 30, 2011 7:25 PM
    Tuesday, August 30, 2011 11:08 AM
  • Perfect, thanks JuneT
    Tuesday, August 30, 2011 7:25 PM