Unnatural Keys

<p>At time of writing, I am working in the music industry. And as part of that work, we want a database of all of the songs in the world so that we can properly identify unknown songs and provide attribution so that folks can get paid appropriately. It is a noble goal with some interesting engineering challenges.</p> <p>There&rsquo;s also some&hellip;&nbsp;<em>less</em>&nbsp;interesting engineering challenges.</p> <p>One is a bit self-inflicted. The first instinct for every DB person when faced with the &ldquo;database of all the songs in the world&rdquo; problem is to go with a&nbsp;<a href="https://en.wikipedia.org/wiki/Natural_key" rel="noopener ugc nofollow" target="_blank">natural key</a>. They think: &ldquo;there&rsquo;s a bunch of IDs we have to store anyways that the business cares about. That&rsquo;s the definition of a natural key! Let&rsquo;s just use them&rdquo;. After all, there are a lot of songs in the world &mdash; slightly more than 100 million, depending on who you ask and what they consider to be a song. Adding our own surrogate means a few hundred megabytes of overhead, excluding indexes on the&nbsp;<em>other</em>&nbsp;IDs that the business cares about.</p> <p>There&rsquo;s even industry standards that&nbsp;<em>should</em>&nbsp;take care of this for us.&nbsp;ISRC&nbsp;is literally the ISO standard (ISO 3901) for &ldquo;uniquely identifying sound recordings&rdquo;. And if you&rsquo;ve worked in software for any length of time, you know that&nbsp;it does not.</p> <p><a href="https://betterprogramming.pub/unnatural-keys-425a68ee350c">Click Here</a></p>
Tags: ISRC natural