RDBMS:将经常更新的列移动到单独的表中 [英] RDBMS : Move frequently updated columns into a separate table

查看:179
本文介绍了RDBMS:将经常更新的列移动到单独的表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表用户(简体):

  UserId(int,PK)|用户名| PasswordHash | LastVisitTimestamp 

每次用户访问网站时,LastVisitTimestamp列都会更新。



将该列移动到单独的表格中是一个好主意,因此时间戳更新不会锁定整个行(实际行大于此处所示)。



我这样做是因为当更新用户信息(乐观并发的更新结果)时,我经常得到行修改异常。



或者是在那里

解决方案

是的,这是解决问题的完全合法的方式。 >

另一个想法是将这些数据存储在基于内存的存储中,批量累积并转储到数据库几秒钟...


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?

解决方案

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...

这篇关于RDBMS:将经常更新的列移动到单独的表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆