How many columns in the table to keep? – MySQL

I am stuck between row vs colunms table design for storing some items but the decision is which table is easier to manage and if colunms then how many colunms are best to have? For example I have object meta data, ideally there are 45 pieces of information (after being normalized) on the same level that i need to store per object. So is 45 colunms in a heavry read/write table good? Can it work flawless in a real world situation of heavy concurrent read/writes?

If all or most of your columns are filled with data and this number is fixed, then just use 45
fields. It’s nothing inherently bad with 45

If all
conditions are met:

  • You have a possibility of the the attributes which are neither known nor can be predicted at design time

  • The attributes are only occasionally filled (say, 10 or less per entity)

  • There are many possible attributes (hundreds or more)

  • No attribute is filled for most entities

then you have a such called sparce matrix
. This (and only this) model can be better represented with an EAV

Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » How many columns in the table to keep? – MySQL

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录