gpt4 book ai didi

database - 时态数据库和历史存档数据库有什么区别?

转载 作者:太空狗 更新时间:2023-10-30 01:42:48 26 4
gpt4 key购买 nike

这里说的是:

http://www.ibm.com/developerworks/web/library/wa-dbdsgn2.html

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据我所知,没有单独的表格。

那么什么时候应该创建另一个表呢?

最佳答案

Robert 从理论上讲的内容 - 无需补充。

实际上,时态表与 main+hist 表还有其他含义。

对于大量维护的数据(例如,更新/删除的数量远远超过插入的数量),具有历史(有时也称为“审计”——因为它是强制执行数据库数据审计跟踪的主要机制)表允许保留主要与将审计信息保存在主表本身相比,该表相当小。这会对主表上的选择和插入产生显着的性能影响,特别是考虑到下面讨论的索引优化。

最重要的是,hist/audit 表上的索引不需要与主表 100% 相同,这意味着您可以省略从 hist 数据库查询审计数据不需要的索引(从而加快插入审计表的速度)并且,反之亦然,优化您拥有的特定审计查询的索引(包括通过聚簇索引按时间戳对表进行排序),而不会使主表背负那些减慢数据更改的索引(以及在更新时聚类的情况下) , 与主表的聚簇索引冲突,所以你通常不能让它按时间顺序聚簇)。

关于database - 时态数据库和历史存档数据库有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1517387/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com