This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Rethinking foreign keys at the app layer
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Like a lot of folks, I've been skeptical of DHH's attitude towards foreign keys and the belief that they should be enforced at the application layer instead of within the database itself. It seems like such a bad idea in theory because, you know, what if the database relationship integrity gets messed up?
However, it just doesn't seem to be an issue in practice. Just ask the folks at eBay (courtesy of Obie Fernandez):
"move cpu-intensive work moved out of the database layer to applications layer: referential integrity, joins, sorting done in the application layer! Reasoning: app servers are cheap, databases are the bottleneck."
Man, if eBay doesn't need referential integrity at the database layer, do I?