开发者

Is searching for a specific table faster than searching for a particular entry in a particular table?

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 s开发者_Python百科hould 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.


It seems like you are looking for acts_as_audited.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜