hassan ammar
hassan ammar

Reputation: 11

Using SQL Server rowversion instead to datetime to track changes

To fetch any record from table that are either inserted or updated, I am using created on date to get inserted records and updated on date to get rows in which any column is updated.

Simple select query is:

SELECT *
FROM [Table] WITH (NOLOCK)
WHERE ([Table].CreatedOnDate >= @Date OR [Table].UpdatedOnDate >= @Date)

(@Date is just a parameter passed to the stored procedure)

Now this table has grown to over 30 million rows and this query is timing out.

I have read about rowversion at MSDN and here

Can I use SQL Server's [Rowversion] column instead of these two date columns to prevent time outs? Is Rowversion faster for searching then date search?

Upvotes: 0

Views: 1037

Answers (0)

Related Questions