[英]Reaffecting dimension of fact table
I am starting to build a star schema, and I like it ^^ 我开始构建星型模式,我喜欢它^^
I have a design problem with dimensional modeling. 我在尺寸建模方面存在设计问题。
I have a Fact table for each transaction in the star schema (highest grain) Something like that (simplified version) 我为星型模式(最高粒度)中的每个事务都有一个事实表(Fact table),类似这样的东西(简化版)
transaction_facts
- id
- account_dim
- date_dim
- status_dim
- amount
status_dim
- id
- code
- description
- final
For a transaction, the status is not clearly defined at process time. 对于事务,在处理时状态没有明确定义。 Most all of the status fall into these cases: 大多数情况都属于以下情况:
The last status is the problematic one, since I can receive the confirmation of the transaction few days (up to 10 and sometime, even more) after the original transaction. 最后一种状态是有问题的状态,因为我可以在原始交易后的几天(最多10天,有时甚至更多)收到交易确认。
How should I handle this kind of late change? 我应该如何处理这种较晚的更改? Intuitively, I would be tempted to just reaffect the existing transactions to the new dimension, but it make me think of 2 things: 凭直觉,我很想将现有交易重新影响到新的维度,但这使我想到了两件事:
If 如果
Then you can/should update the value. 然后,您可以/应该更新该值。
If using Redshift then you can do this efficiently by writing a batch of updates to a staging table (copy from s3) then applying these all in one go as an update. 如果使用Redshift,则可以通过将大量更新写入登台表(从s3复制)然后一次全部应用这些更新来有效地做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.