Skip to main content
edited body
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

I was not able to reproduce what you see. Probably because I have a slow computer. But on the other hand it seems that the SQL Server developers hashave built this with my slow computer in mind and not your fast one.

If I wrapped the insert and delete in a transaction they got the same start and enend timestamp every time.

From Temporal Tables

FOR SYSTEM_TIME filters out rows that have period of validity with zero duration (SysStartTime = SysEndTime). Those rows will be generated if you perform multiple updates on the same primary key within the same transaction. In that case, temporal querying surfaces only row versions before the transactions and ones that became actual after the transactions. If you need to include those rows in the analysis, query the history table directly.

So, if start and end timestamp are the same they assume it happened in the same transaction.

I was not able to reproduce what you see. Probably because I have a slow computer. But on the other hand it seems that the SQL Server developers has built this with my slow computer in mind and not your fast one.

If I wrapped the insert and delete in a transaction they got the same start and en timestamp every time.

From Temporal Tables

FOR SYSTEM_TIME filters out rows that have period of validity with zero duration (SysStartTime = SysEndTime). Those rows will be generated if you perform multiple updates on the same primary key within the same transaction. In that case, temporal querying surfaces only row versions before the transactions and ones that became actual after the transactions. If you need to include those rows in the analysis, query the history table directly.

So, if start and end timestamp are the same they assume it happened in the same transaction.

I was not able to reproduce what you see. Probably because I have a slow computer. But on the other hand it seems that the SQL Server developers have built this with my slow computer in mind and not your fast one.

If I wrapped the insert and delete in a transaction they got the same start and end timestamp every time.

From Temporal Tables

FOR SYSTEM_TIME filters out rows that have period of validity with zero duration (SysStartTime = SysEndTime). Those rows will be generated if you perform multiple updates on the same primary key within the same transaction. In that case, temporal querying surfaces only row versions before the transactions and ones that became actual after the transactions. If you need to include those rows in the analysis, query the history table directly.

So, if start and end timestamp are the same they assume it happened in the same transaction.

Source Link
Mikael Eriksson
  • 22.2k
  • 5
  • 61
  • 104

I was not able to reproduce what you see. Probably because I have a slow computer. But on the other hand it seems that the SQL Server developers has built this with my slow computer in mind and not your fast one.

If I wrapped the insert and delete in a transaction they got the same start and en timestamp every time.

From Temporal Tables

FOR SYSTEM_TIME filters out rows that have period of validity with zero duration (SysStartTime = SysEndTime). Those rows will be generated if you perform multiple updates on the same primary key within the same transaction. In that case, temporal querying surfaces only row versions before the transactions and ones that became actual after the transactions. If you need to include those rows in the analysis, query the history table directly.

So, if start and end timestamp are the same they assume it happened in the same transaction.