7

I am learning to use CDC in SQL server 2008, I have read that LSN is always incremented and is based upon timestamp, so why LSN is required, if it is calculated from timestamp which can be used as increamental sequence id for changes made. I am sure that there will be some other purpose as well of lsn.

  • 1
    Have a look at my answer here for further reading. – Jon Seigel Mar 25 '13 at 13:29
11

A date/time value is generally not considered to be unique enough. No matter how fine you define it, it is possible to have 2 actions occurring for the same datetime value.

Prior to SQL Server 2008, the most accurate value was a rounded 3.33 milliseconds with datetime which is an eternity really. datetime2 resolves to 100 nanoseconds which isn't accurate enough either.

From another view, time is is a real number. No matter how accurately you store a time, there is always some rounding to your level of resolution (In this case, 3.33 ms or 100 ns)

Using LSN (which is numeric (25,0)) gives a strictly monotonically increasing unambiguous whole number value. It is a natural number

  • 2
    Most RDBMSes do the same - Oracle uses a system change number (SCN), for example. – Philᵀᴹ Mar 25 '13 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.