Optimize Your Application Using a Timestamp
|
(Ben Taylor) The TIMESTAMP data type is an often miss-understood and under-utilized feature built into SQL Server. Adding a TIMESTAMP column to your tables can increase the performance of your transaction databases. This article tells you why and how. |
|
| Related Articles - For Members.
|
|
Key (Please note):
(R) - registration may be required for access at the target site
($) - target site may require paid membership for access to this or other content
Reader Comments: Post Your Comments/Feedback
RE: Optimize Your Application Using a Timestamp (posted: 6/21/2005 9:26:02 AM) Great article, but I think you should've pointed out that the timestamp column gets updated even if none of the data values in the row change. If the user changes their mind about making a change and hits Save anyway, then the TS column thinks the row has changed when actually nothing has.
DECLARE @TSTABLE TABLE (IntId int NOT NULL, TS timestamp NOT NULL) INSERT @TSTABLE (IntId) VALUES (1) SELECT * FROM @TSTABLE UPDATE @TSTABLE SET IntId = 1 WHERE IntId = 1 SELECT * FROM @TSTABLE
RE: Optimize Your Application Using a Timestamp (posted: 6/22/2005 9:00:47 AM) Thanks for your comment. It is true that the TIMESTAMP is always updated every time a record is inserted or updated. ADO is intellegent enough to know not to update if nothing was modified. But if you always update, even if there is no change required, SQL Server will update the TIMESTAMP. This method is in contradiction to the whole purpose of the TIMESTAMP column in the first place. But it is true. BT
|