Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What will happen when timestamp (rowversion) overflow?

I'm wonder if it's safe to compare the values of timestamp in a table to get the newly updated/inserted rows. (e.g. SQL Server RowVersion/Timestamp - Comparisons).

What will happen if timestamp reaches the maximum value of binary(8) in a very very large/frequently updating database?

like image 328
ca9163d9 Avatar asked Jul 09 '13 23:07

ca9163d9


People also ask

Is Rowversion the same as timestamp?

timestamp is the synonym for the rowversion data type and is subject to the behavior of data type synonyms. In DDL statements, use rowversion instead of timestamp wherever possible. For more information, see Data Type Synonyms (Transact-SQL).

What is the use of Rowversion in SQL Server?

ROWVERSION is just an incrementing number, it does not preserve date or time information. It be used to control concurrent access to the same rows. With SQL Server 2005, the CONVERT() function does not properly transform the hexadecimal string to a binary value.

What is timestamp column in SQL Server?

Timestamp is a synonym for rowversion. Rowversion data type is not a date or time data type. Each database has a counter that is incremented for each insert or update operation that is performed on a table that contains a rowversion column within the database. This counter is the database rowversion.

How do I find Rowversion in SQL Server?

You can use the @@DBTS function to get the current rowversion of a given database in SQL Server. More specifically, it returns the last-used rowversion value of the current database.


1 Answers

It won't.

If you do a million updates a second, every second, the timestamp will wrap around in about 585000 years.

like image 170
Guffa Avatar answered Oct 22 '22 04:10

Guffa