I need to create a history table for particular resource and am trying to decide how to design it. My current thought was to create a separate table for each instance of the resource and enter a new value whenever there is something to new add. Would that be quicker? Or should I try to put everything in one table and search through it? I am not too sure how to fit it in one table yet but I figured knowing if there would be a speed hit would be a good start.
我需要为特定资源创建一个历史表,并试图决定如何设计它。我目前的想法是为每个资源实例创建一个单独的表,并在有新内容添加时输入新值。会更快吗?或者我应该尝试将所有内容放在一个表中并搜索它?我不太确定如何将它放在一张桌子上,但我想知道是否会有一个速度命中将是一个良好的开端。
3 个解决方案
#1
0
If you have a history, it would be simple enough to have a table like...
如果你有一个历史,那么就像一张桌子一样简单......
history_id | resource_id | history_event
1 | 1 | created
2 | 1 | updated with silly info
With an index on resource_id
it will be plenty fast. :)
使用resource_id上的索引会很快。 :)
#3
1
If the data logically belongs in one table, put it in one table. Don't prematurely vertically or horizontally partition your data unless you have a good reason.
如果数据逻辑上属于一个表,则将其放在一个表中。除非有充分的理由,否则不要过早地垂直或水平地划分数据。
#1
0
If you have a history, it would be simple enough to have a table like...
如果你有一个历史,那么就像一张桌子一样简单......
history_id | resource_id | history_event
1 | 1 | created
2 | 1 | updated with silly info
With an index on resource_id
it will be plenty fast. :)
使用resource_id上的索引会很快。 :)
#2
#3
1
If the data logically belongs in one table, put it in one table. Don't prematurely vertically or horizontally partition your data unless you have a good reason.
如果数据逻辑上属于一个表,则将其放在一个表中。除非有充分的理由,否则不要过早地垂直或水平地划分数据。