MySQL Performance Example Was: Seriously, WTF?

James Laver james.laver at gmail.com
Sat May 10 15:27:14 BST 2008


On 10 May 2008, at 15:05, Iain Barnett wrote:
> There are 2 things needed for any piece of documentation, the What,  
> and the Why. Nothing about a datatype, or code in general explains  
> the reason behind a decision (although in simple cases it can be  
> inferred), and that is usually the most important aspect behind what  
> was done.
>
> How does an enum self-document if there are (at least) 4 reasons for  
> it's use?
> <snip rubbish>

At $work, we have a system where Genres and Tags are both used in the  
Tag table and an enum to denote type (there are a couple of others,  
but never mind).

So you want to create a new genre, you can look at the table with  
describe, see the type field (which happens to be an enum) and see  
that the possibilities are (tag, genre, other).

Now you know all the possibilities it could be and you also know how  
to spell each one (capitalisation etc.)

It isn't going to replace documentation, but it's a damn sight clearer  
than yet another foreign key.

--James


More information about the london.pm mailing list