问题
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:
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...
来源:https://stackoverflow.com/questions/3868127/rdbms-move-frequently-updated-columns-into-a-separate-table