Re: Question on simulating Enum Data type - Mailing list pgsql-novice

From Tom Lane
Subject Re: Question on simulating Enum Data type
Date
Msg-id 12537.1111207118@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question on simulating Enum Data type  ("Morgan Kita" <mkita@verseon.com>)
List pgsql-novice
"Morgan Kita" <mkita@verseon.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

pgsql-novice by date:

Previous
From: George Weaver
Date:
Subject: Re: output a single and double quote in a string
Next
From: Andreas Kretschmer
Date:
Subject: Re: [despammed] Destination table by variable?