Concurrency Update Issue in Temporal Tables

ARUNKUMAR KRISHNASAMY 0 Reputation points
2025-01-14T23:25:54.5433333+00:00

For a system-versioned table, when concurrent operations like INSERT, UPDATE, or DELETE are performed, the system-generated timestamps (SYSTEM_TIME columns) may reflect the same value. This makes it challenging to determine the exact sequence of the operations.

For example, when the following queries are executed in a single execution without any delay:

UPDATE TableA SET Column1 = Value WHERE ID = 1;

UPDATE TableA SET Column10 = Value WHERE ID = 1;

DELETE FROM TableA WHERE ID = 1;

In this scenario, all system-versioned timestamps are identical. Is there a way to determine the order of operations—first, second, and so on—without making changes to the schema?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,485 questions
{count} votes

2 answers

Sort by: Most helpful
  1. 博雄 胡 545 Reputation points
    2025-01-15T05:57:48.8766667+00:00

    As far as I can tell, it's by transactionid, not by time

    0 comments No comments

  2. LiHongMSFT-4306 30,751 Reputation points
    2025-01-16T08:34:13.8366667+00:00

    Hi @ARUNKUMAR KRISHNASAMY

    If the table contains a rowversion column, it incremented for each insert or update operation that is performed on that table.

    It tracks a relative time within a database, not an actual time that can be associated with a clock.

    See this doc: rowversion (Transact-SQL)

    Best regards,

    Cosmog


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.