分享表还是不共享? [英] To share a table or not share?
问题描述
这被称为垂直分区,一般来说,无论您选择哪个选项,它都不会有太大差异。
一个垂直分区方法是将很少更新的字段经常更新的字段进行拆分。想象一下Stack Overflow数据库中的 Users
表,具有 User_ID
, DisplayName
,位置
等等,然后 UpVotes
, DownVotes
, LastSeen
, NumberOfQuestionsAsked
等。第一组字段很少更改(仅在配置文件编辑中)而另一种分割方式可能是频繁访问的数据之间的数据,很少访问的数据。
在某些特定情况下,这种分区可以产生更好的表现。
Right now on my (beta) site i have a table called user data which stores name, hash(password), ipaddr, sessionkey, email and message number. Now i would like the user to have a profile description, signature, location (optional) and maybe other things. Should i have this in a separate mysql table? or should i share the table? and why?
This is called vertical partitioning, and in general it will not make much difference whichever option you go for.
One vertical partitioning method is to split fields that are updated frequently from fields that are updated rarely. Imagine a Users
table in Stack Overflow's database, having User_ID
, DisplayName
, Location
, etc... and then UpVotes
, DownVotes
, LastSeen
, NumberOfQuestionsAsked
, etc. The first set of fields changes rarely (only on profile edits), while the latter set change frequently (on normal activity).
Another splitting method could be between data that is accessed frequently, from data that is accessed rarely.
This kind of partitioning, in some particular situations, can yield better performance.
这篇关于分享表还是不共享?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!