List Info

Thread: Re: MySQL Performance Example Was: Seriously, WTF?




Re: MySQL Performance Example Was: Seriously, WTF?
country flaguser name
United Kingdom
2008-05-09 22:30:57
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://aggreg
ator.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.



Re: MySQL Performance Example Was: Seriously, WTF?
user name
2008-05-10 04:34:45
Iain Barnett writes:

> 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.
> 
> > 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 :_)

Sure you can encapsulate things like that in your programs,
but having
the mnemonic values is useful for a human manually
performing a SELECT
to examine a record.

Smylers

Re: MySQL Performance Example Was: Seriously, WTF?
country flaguser name
Netherlands
2008-05-10 06:11:08
On 10 May 2008, at 05:30, Iain Barnett wrote:
>
> [1] Please, don't use the words 'self documenting'. It
melts my  
> brain as much as crap on a bed being called art [2]


It is. Move along.

-- 
Dave Hodgkinson                                MSN:
davehodghotmail.com
Site: http://www.davehodgkins
on.com                   UK: +44 7768 49020
Blog: http://davehodg.blogspot
.com                    NL: +31 654 982906
Photos: http://www.flic
kr.com/photos/davehodg






Re: MySQL Performance Example Was: Seriously, WTF?
country flaguser name
United Kingdom
2008-05-10 07:27:40
On Sat, May 10, 2008 at 04:30:57AM +0100, Iain Barnett
wrote:
> On 9 May 2008, at 5:07 pm, David Cantrell wrote:
> >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]

Oh, yeah, documentation.  The thing that you have to open in
another
window, search through, and so on - if you even stop to
think that you
might need to refer to it.

An ENUM is self-documenting.

> [1] Please, don't use the words 'self documenting'.

Tough titty!

-- 
David Cantrell | Godless Liberal Elitist

In this episode, R2 and Luke weld the doors shut on their
X-Wing,
and Chewbacca discovers that his Ewok girlfriend is really
just a
Womble with its nose chopped off.

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )