@L_502_0@
Each table in the DB should have a history table,mirroring the entire
history of the primary table. If
entries in the primary table are to be
updated,the old contents of the
record are first copied to the history
table before the update is made. In
the same way,deleted records in the
primary table are copied to the
history table before being deleted
from the primary one. The history
tables always have the name of the
corresponding primary one,but with
_Hist appended.
在时间数据库中看到这里temporal database modeling and normalisation没有一个单独的表,据我所知.
那么什么时候应该创建另一个表?
解决方法
实际上,时间表与主要表格有其他的关系.
具有历史性(有时也称为“审计”)的严重维护的数据(例如,更新/删除大大超过插入数据),因为它是实施DB数据的审计跟踪的主要机制)表允许保持主表格相当小相比于将审核信息保存在主表中.这可能对主表上的选择和插入都有显着的性能影响,特别是基于下面讨论的索引优化.
最重要的是,hist / audit表中的索引不需要与主表完全相同,这意味着您可以忽略从hist数据库查询审核数据所不需要的索引(从而加快插入到审计表中),而副反之亦然,优化您所拥有的特定审核查询的索引(包括通过聚簇索引按时间戳排序表),而无需使用缓慢数据更改的索引来缓存主表(并且在更新时间集群的情况下,与主表的聚集索引,因此通常不能按照时间顺序进行聚类).