gpt4 book ai didi

sql - 是否有一个术语来描述只应使用最后一个值的表?

转载 作者:行者123 更新时间:2023-12-04 20:19:40 24 4
gpt4 key购买 nike

在我的数据库中有每一行代表一个实体的表,还有其他表中同一实体可以多次出现,但只有最新的条目才是有效的。

例如,我有一张表 customer其中每一行代表一个客户和另一个表 customer_membership_status可以多次引用同一个客户,但只支持使用每个客户的最后一条记录。数据从不更新 customer_membership_status ,才插入。

有没有术语可以描述这种模式?我这么问是因为我想快速轻松地向其他人解释该表的预期用途。

最佳答案

最好的术语可能是 CQRSevent sourcing

Using the stream of events as the write store, rather than the actual data at a point in time, avoids update conflicts on a single aggregate and maximizes performance and scalability

Event Sourcing pattern

Instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data. The store acts as the system of record and can be used to materialize the domain objects. This can simplify tasks in complex domains, by avoiding the need to synchronize the data model and the business domain, while improving performance, scalability, and responsiveness. It can also provide consistency for transactional data, and maintain full audit trails and history that can enable compensating actions.



编辑:

仔细看看你还可以读到 SCD(Slowly Changing Dimension)类型 2。

This method tracks historical data by creating multiple records for a given natural key in the dimensional tables with separate surrogate keys and/or different version numbers. Unlimited history is preserved for each insert.

关于sql - 是否有一个术语来描述只应使用最后一个值的表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46856197/

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