views:

17

answers:

1

I have a table Users (simplified) :

UserId (int, PK) | Username | PasswordHash | LastVisitTimestamp

Every time user visits a web site, LastVisitTimestamp column is updated.

Is it a good idea to move that column into a separate table, so that timestamp updates do not lock entire row (actual row is bigger than presented here).

I did that because I was frequently getting "row modified" exception when updating user information (result of update with optimistic concurrency).

Or is there a better (preferred) way to handle this?

+1  A: 

Yes, this is totally legit way of solving the problem.

Another ideas are storing such data in memory-based storage, accumulate and dump to database once per few seconds in batches...

BarsMonster