活动历史存储设计模式

发布于 2024-12-13 15:50:25 字数 482 浏览 0 评论 0原文

研究案例:

如果我有例如库对象。 图书馆里有书。 每本书都有通用信息,如名称、日期……以及其他一些依赖项,如作者、经销商……

我有 Person 对象。 如果Person读了这本书,那么我想创造新的记录进入历史。

现在的问题是,什么更好:

1)使用 Book 实体及其依赖项中的所有数据在历史中创建静态记录(在这种情况下,如果 Book 将被更改,那么历史将不是实际的)

2)Strore依赖于Book对象(在这种情况下历史记录将是实际的,但在每个请求中我必须查看所有依赖项)

我认为Books将被更改

并且历史记录将显示在人物简介。 (这个假设响应将答案1))

但是历史应该基于实际的图书数据吗?或者历史应该有创建历史的日期信息?

书和人只是例子

Study case:

If I have for example The library object.
In the library are books.
Every book have common information like Name, Date, .... And some other dependencies like Autor, Reseller, ....

I have Person object.
If Person read the book, then I want make new record into history.

And now the problem, what is better:

1) Create static record in history with all data from Book entity and his dependencies (In this case If the Book will be changed, then history will not be actual)

or

2) Strore dependecy on Book object (In this case history will be actual, but in every request I must look at all dependencies)

I suppose that Books will be changed offen

And the History will be displayed in Person profile. (This assumption response will Answer 1) )

But should be history based on actual Book datas ? Or history should have the information form date where history was created ?

Book and Person are only examples

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

西瑶 2024-12-20 15:50:25

现在的问题是,什么更好:

1) 使用 Book 实体中的所有数据在历史中创建静态记录,并
他的依赖项(在这种情况下,如果这本书将被更改,那么
历史不会是真实的)

2) 存储对 Book 对象的依赖关系(在这种情况下,历史记录将是
实际的,但在每个请求中我必须查看所有依赖项)

不确定这里的“实际”实际上是什么意思,但更好的选择是适合您的需求的选择。

使用选项 1,当您稍后在个人资料中显示历史记录时,它将包含有关创建历史记录时当前图书的信息。使用选项 2,个人资料将显示查看个人资料时当前图书的信息。

您想在个人资料中看到哪些内容?

如果实际上您希望始终显示历史记录创建时的当前信息,这就是构建具有时间维度的数据仓库的原因之一。如果这是您所需要的,并且如果您需要处理大量历史数据,那么您可能需要考虑构建一个与事务数据库分开的数据仓库。

有关数据仓库的一些信息,这篇 IBM 红皮书文章可能有用。

And now the problem, what is better:

1) Create static record in history with all data from Book entity and
his dependencies (In this case If the Book will be changed, then
history will not be actual)

or

2) Store dependency on Book object (In this case history will be
actual, but in every request I must look at all dependencies)

Not sure what you actually mean by "actual" here, but the better choice is the one that suits your needs.

With option 1, when you later show the history record in your Person Profile, it will contain the information about the book which was current at the time the history record was created. With option 2, the profile will show the information about the book that is current at the time the profile is viewed.

Which do you want to see in the profile?

If in fact you want to always show information that was current at the time of the history record creation, this is one of the reasons for building a data warehouse with a time dimension. If this is what you need, and if it's something you need to do with alot of history data, you might want to look into building a data warehouse separate from your transactional database.

For some information on data warehouses, this IBM Redbook article might be useful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文