Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group