Assembly: System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)
'Declaration Public Enumeration PurgeType 'Usage Dim instance As PurgeType
public enum PurgeType
public enum class PurgeType
public enum PurgeType
|None||This value is reserved for use by the tracking infrastructure. Do not use it in your code.|
|TimeBased||Specifies that metadata will be deleted based on whether it is older than a specified number of days.|
|CsnBased||Specifies that metadata will be deleted based on the Commit Sequence Number (CSN) of the last transaction to modify it.|
|Max||This value is reserved for use by the tracking infrastructure. Do not use it in your code.|
A time-based purge deletes the metadata, when the metadata is older than a specified number of days. For example, in an application that uses tracking to implement sync, tracking data is no longer needed after the data is synched to the server (or a set of peers). The application could retain tracking data only for a specific number of days (n) and impose a restriction on users that they sync with the server (or the set of peers) at least every n days.
A CSN-based purge deletes the metadata, when the metadata is modified last by a transaction, with a CSN that is less than or equal to a specified CSN. The CSN associated with a row indicates the commit order of the transactions in which the database has been enlisted. In a CSN-based purge, data is deleted based on commit sequence, not time sequence. For example, if a row was modified last by a transaction that committed 100 transactions ago from current time, it may no longer be needed.
CSN-based cleanup makes sense because changes made by transactions are visible to an application only after the transaction is committed. For example, a notifications application built on change tracking can notify subscribers about changes only after a transaction that has changed data commits. The application could retain a buffer of the last 100 transactions, to allow for subscribers to respond to the notifications, and purge anything older than that.
A time-based purge is not equivalent to CSN-based purge because the timestamp of a row is assigned at the time of an insert or update. In the case of a long running transaction, the commit time can differ significantly from the timestamp value of the modified row. A CSN-based purge does not delete metadata until after the transaction has committed.