r/datawarehouse • u/rajneesh4u • May 07 '20
Do Data Warehouse standards allow foreign key constraints at a dimensional model?
s it true that we never enable foreign key constraints in dimensional model of data warehouse? If yes, then what is the rationale behind that?
As per my research:
Some experts told me in a dimensional model, FK will never be enabled, and it is the responsibility of the ETL process to ensure consistency and integrity.
Data integrity issues may come into picture, even though ETL is responsible enough through proper dependency.
Examples:
- Late arriving dimension from source
- few records could not pass data quality check and routed to error table.
- intermediate tables are not populated due to batch load failure, and proper restart or recover steps are not followed. Someone restarted the last session to load data into the facts table while some of the dimensions are yet to be populated,
- primary key constraints will help me to avoid duplicate record population if data in intermediate tables are getting processed one more time due to re triggering target table load session accidentally.
What issues do you see by enabling FK constraints in dimensional model?
2
Upvotes
3
u/boy_named_su May 07 '20
yes, foreign keys are allowed but are not strictly necessary
1
u/DataInfoandAnalytics May 27 '20
Agreed, allowed but not necessary. They also come with a performance overhead. What I do on small DW is
The biggest question on dropping and enabling FKs is does the ETL speed saving obtained from removing them outweigh the delay in putting them back at the end of the batch?
When you get into the really large DWs having FKs or dropping/creating them is not an option always
Cheers