The writings of Merlin Moncure, professional database developer, about work, life, family, and everything else.

Monday, February 10, 2014

Bitcoin is fine; Surrogate keys are the problem.

If you've been following the bitcoin saga you may have heard about Mt Gox's halting of currency withdrawals.  Well, it's come out that due to their (completely preventable) improper transaction tracking bad actors have been gaming them.  Oops.

Mt Gox (bitcoin exchange) uses surrogate key improperly and pays the price.

I've determined a long time ago that overuse of surrogate keys is a huge problem in the database industry.  They encourage lazy model design and poor understanding of database fundamentals.  Their main advantage over natural keys is they facilitate cheap updates of the key since it isn't used for purposes of relating.  Unfortunately that can lead to disastrous consequences since the data underlying the key is often important and that is exactly what happened here.