Go Back   CORTEX Forums > Local Happenings > CORTEX Blogs > Random Procrastination
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Poll Results: Foreign Key Constraints

This is a discussion on Poll Results: Foreign Key Constraints within the Random Procrastination forums, part of the CORTEX Blogs category; A few weeks ago I did the following post asking people – if they used foreign key constraints in their star schemas. The poll is still open if you are ...


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 24th May 2010, 11:05 AM   #1
Senior Member
 
Join Date: Jun 2009
Posts: 62
Darren Gosbell is on a distinguished road
Thumbs up Poll Results: Foreign Key Constraints

A few weeks ago I did the following post asking people – if they used foreign key constraints in their star schemas.

The poll is still open if you are interested in adding to it, but here is what the chart looks like as of today. (at the bottom of the poll itself there is a link to the live results, unfortunately I cannot link the live results in here as the blogging platform blocks the required javascript)



*

Interestingly the results are fairly even. Of the 78 respondents, fractionally over half at least aim to start with referential integrity in their star schemas.

I did not want to influence the results by sharing my opinion, but my personal preference is to always aim to have foreign key constraints. But at the same time, I am pragmatic about it, I do have projects where for various reasons some constraints are not defined. And I also have other designs that I have inherited, where it would just be too much work to go back and add foreign key constraints. If you are going to implement foreign keys in your star schema, they really need to be there at the start.

In fact this poll was was the result of a feature request for BIDSHelper asking for a feature to check for null/missing foreign keys and I am entirely convinced that BIDS is the wrong place for this sort of functionality. BIDS is a design tool, your data needs to be constantly checked for consistency.

It's not that I think that it's impossible to get a design working without foreign key constraints, but I like the idea of failing as soon as possible if there is an error and enforcing foreign key constraints lets me "fail early" if there are constancy issues with my data.

By far the biggest concern with foreign keys is performance and I suppose I'm curious as to how often people actually measure and quantify this. I worked on a project a number of years ago that had very large data volumes and we did find that foreign key constraints did have a measurable impact, but what we did was to disable the constraints before loading the data, then enabled and checked them afterwards. This saved as time (although not as much as not having constraints at all), but still let us know early in the process if there were any consistency issues.

For the people that do not have consistent data, if you have ETL processes that you control that are building your star schema which you also control, then to be blunt you only have yourself to blame. It is the job of the ETL process to make the data consistent. There are techniques for handling situations like missing data as well as* early and late arriving data. Ralph Kimball's book – The Data Warehouse Toolkit goes through some design patterns for handling data consistency.

Having foreign key relationships can also help the relational engine to optimize queries as noted in this recent blog post by Boyan Penev






Get More from the original blog...
Darren Gosbell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTweet this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


LinkBacks (?)
LinkBack to this Thread: http://www.tbig.com.au/forums/random-procrastination/13411-poll-results-foreign-key-constraints.html
Posted By For Type Date
Backlink Checker This thread Refback 4th August 2010 09:33 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Computer analysis of Twitter sentiments yields results similar to public opinion poll BuzzNumbers BuzzNumbers 0 13th May 2010 05:35 AM
Poll: Foreign Key Constraints Darren Gosbell Random Procrastination 0 24th March 2010 06:09 PM
Expand your mind using constraints. Cooking with 7-11 and Cadbury Mini Eggs. admin Prediction Markets News Feeds 0 24th February 2010 06:35 AM
One Question DoD IT Poll admin Prediction Markets News Feeds 0 31st December 2009 09:13 AM
ADMA Data Day 2009 audience poll results comparing consumer contact preference vs. d admin Presentation News Feeds 0 19th November 2009 03:37 PM


All times are GMT +11. The time now is 10:33 PM.

© The Business Intelligence Group

Search Engine Optimization by vBSEO