SCD 1 dimension without surrogate key

旧城冷巷雨未停 提交于 2021-02-11 14:49:12

问题


This reference to Kimball group state that all dimensions should have surrogate keys except some very predictable one like date diemnsion.

I have exactly the same case as described at SCD Type 1 Wiki page:

Technically, the surrogate key is not necessary, since the row will be unique by the natural key (Supplier_Code).

Data are loaded from operational system without surrogate key, while I calculating surrogate key in ETL based on single and unique xxx_code column. SCD Type 1, full load.

Are there any reasons to use surrogate key in my case instead of making natural key from xxx_code column?


回答1:


Surrogate keys have certain advantages:

  • They protect data, so the built-in keys do not need to be visible everywhere.
  • They allow the surrogate key to be changed.
  • Surrogate keys are usually numbers, which is more efficient than compound keys or strings.

All that said, natural keys might be quite useful sometimes. For example, I work with rather complex chains of systems. Introducing new keys in each system just starts to get confusing -- which is the product code, for instance.

Despite my bias toward surrogate keys, natural keys can be useful in such cases. What is important is that such keys be primary keys, that they really cannot change values, and that they are -- preferably -- numbers (which are more efficient for foreign key relationships).



来源:https://stackoverflow.com/questions/60736651/scd-1-dimension-without-surrogate-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!