Best Practice for UpdateConcurrencyType?


Author
Message
Edhy Rijo
E
StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi,

What would be the best option to use between the RowVersion and TimeStamp for checking the concurrency type and why?

Edhy Rijo

Replies
Peter Jones
Peter Jones
StrataFrame User (456 reputation)StrataFrame User (456 reputation)StrataFrame User (456 reputation)StrataFrame User (456 reputation)StrataFrame User (456 reputation)StrataFrame User (456 reputation)StrataFrame User (456 reputation)StrataFrame User (456 reputation)StrataFrame User (456 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Guys,

Not wishing to be pedantic here but a timestamp data type has nothing to do with date/time - it's just sequential binary number that is incremented by 1 every time a row is inserted or updated in the database - yes the database not the table the row is in. So, every row in the database with a timestamp column will always have a unique number in that column.

Cheers, Peter

Trent Taylor
Trent Taylor
StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Peter,

You are right, but that was not my point.  The performance issue is not with the incrementing of the value...it is if it will be used within queries for any purpose.  It isn't a drastic difference, but I have actually set this up and dealt with this recently, so I know that the TimeStamp is slower than the integer if you will be performing any query operation on the WHERE side that includes a >, <, or a between operation.

It is not noticeable unless you are dealing with a larger data set.  If you are never going to have a a large database then it really doesn't matter...but I know for a fact that the integer is faster than the time stamp when it relates to queries when dealing with large data sets.  If you never do anything but an equal operation on the column then there will not be a noticeable difference whether you are using an integer or a TimeStamp column.  But why worry about all of this....if you create a integer row version column then you never have to worry with it regardless....but to each his own Smile  I was asked for best practices....and this would fall into that category in my book. Smile

Trent Taylor
Trent Taylor
StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
One other point here....if you actually wanted to include the concurrency field in any type of query, you are dealing with, as you said, binary data.  This becomes more difficult to include in queries if you are trying to determine something in regards to auditing, etc.  So if you were trying to filter out records to see only records that have been modified, then you would have to create a query using values like this:

SELECT COUNT(*) FROM MyTable WHERE MyTimeStampField <= 0x00000000000007D1

(Which obviously you would want to use a parm, but you get my point)

Versus using an integer value

SELECT COUNT(*) FROM MyTable WHERE MyTimeStampField <= 1

So anyway that I look at it...it is far easier to deal with an integer...at least in my simple world Tongue

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search