Re: ENUM type

From: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
To: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
Cc: Chris Travers <chris(at)travelamericas(dot)com>, PostgreSQL advocacy <pgsql-advocacy(at)postgresql(dot)org>
Subject: Re: ENUM type
Date: 2005-07-27 04:11:25
Message-ID: 42E7096D.5050407@empires.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-hackers

Jim C. Nasby wrote:

>>
>>Yeah, you're right. But this is only in the case where someone cares
>>about using an int rather than a string type for some performance
>>reason. If they don't mind wasting a few bytes (and it's really only a
>>few bytes per record), then why not just use a check constraint when
>>defining the table (like Chris explains)?
>
>
> Normalization is about a lot more than just saving space in your base
> tables. But since that's the example you used, you a) can't assume it's
> only a few bytes and b) can't assume that those few bytes won't start to
> seriously add up over the span of a few hundred million rows.
>
> Remember: while disk space might be cheap, disk I/O bandwidth costs a
> fortune.
>

First, I doubt there exists a single case in the universe where someone
has 100 million rows of an enum type in MySQL, and they want to convert
to PostgreSQL without redefining their tables.

I would say the separate table is the way I would do it, but as far as a
conversion from MySQL->PostgreSQL, why are we trying to normalize their
tables along the way? Wouldn't the simple solution be the way to get
them started?

Nobody is going to expect that much from a conversion. They get their
app going on PostgreSQL, and slowly start to do things the right way. If
we hide the fact that we're normalizing their data, how does that really
help them?

However, it's fine with me if we do it that way. If there's additional
effort I just don't know whether it's worth it.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message Chris Travers 2005-07-27 05:33:25 Re: ENUM type
Previous Message Jeff Davis 2005-07-27 03:59:11 Re: [HACKERS] Enticing interns to PostgreSQL

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-07-27 04:31:47 Re: psql as an execve(2) interpreter
Previous Message Tom Lane 2005-07-27 04:08:18 Re: RESULT_OID Bug