MIN_ACTIVE_ROWVERSION() returns the lowest rowversion allocated within still-open transactions. This is important when using rowversion columns for reading data where you want to be sure that you wont subsequently miss rows that have been written with rowversions lower than the batch you have just read.

What is the behaviour of this function when called on synchronous and asynchronous replicas in an AlwaysOn Availability Group situation?

  • The function behaves the same on secondary AG replicas as on any other instance. However, the behavior is not just for open transactions. When using RCSI isolation level, row versioning is used for all statements, making reads consistent to the point in time at the start of the statement. AG Secondaries always use RCSI, regardless of the primary's isolation level – AMtwo Jul 12 '17 at 1:36
  • @AMtwo Seconday replicas (readable only) use snapshot isolation, not rcsi. SI and RCSI behave slightly different. – Sean Gallardy - Retired User Jul 12 '17 at 2:47

On further investigation, it appears than MIN_ACTIVE_ROWVERSION() only behaves correctly on the primary instance, as that is the only place the full transactions are running on.

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.