MySQL Performance Example Was: Seriously, WTF?
Iain Barnett
iainspeed at gmail.com
Sat May 10 04:30:57 BST 2008
On 9 May 2008, at 5:07 pm, David Cantrell wrote:
> On Fri, May 09, 2008 at 04:47:23PM +0100, Iain Barnett wrote:
>
>> Int, enum, char in that order.
>
> I've always treated ENUM as being more a reminder to myself and to
> whoever has to maintain my stuff about what the column is for. eg,
> that
> the 'pigment' field can contain cyan, magenta, yellow or black but
> nothing else.
Um, documentation? You know, that thing no one likes to do. [1]
> It also saves the hassle of me having to remember which
> of C M Y and K maps to which integer
When would you need this information? Have you been hard-coding
values in your code, tsk tsk :_)
> and saves the database the hassle
> of looking up the human-readable names for those integers in another
> table.
This is the only place I could find a benchmark
http://aggregator.foolab.org/node/26143
It shows the enums outperform the joins where sorting is needed,
which is interesting (and would possibly change with different
indexing), but elsewhere the difference is negligible. I'm more
comfortable with the non-enum strategy, but maybe that is my luddite
side.
Iain
[1] Please, don't use the words 'self documenting'. It melts my brain
as much as crap on a bed being called art [2]
[2] 5 packs of jellybeans and a night on the Guinness, and it may
well have become art.
More information about the london.pm
mailing list