Re: Question on simulating Enum Data type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Morgan Kita" <mkita(at)verseon(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Question on simulating Enum Data type
Date: 2005-03-19 04:38:38
Message-ID: 12537.1111207118@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Morgan Kita" <mkita(at)verseon(dot)com> writes:
> Hmm still I wonder, won't the varchar/char compares be much slower
> than using a seperate map table, grabbing the int value, and then only
> doing int compares?

Certainly a string compare is slower than an integer compare, but you
have to consider the context. In database work what usually counts more
than any CPU effort is the amount of disk I/O --- and that means that
adding a table join to avoid a string compare is being penny-wise
and pound-foolish.

It'd be well worth your while to set up a few experimental comparisons
to see how this plays out in practice. Either answer *could* be right
depending on your situation.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andreas Kretschmer 2005-03-19 07:41:16 Re: [despammed] Destination table by variable?
Previous Message George Weaver 2005-03-19 04:15:26 Re: output a single and double quote in a string