Re: int id's helpful for indexing, or just use text names?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gry(at)ll(dot)mit(dot)edu
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: int id's helpful for indexing, or just use text names?
Date: 2002-10-15 21:06:58
Message-ID: 18502.1034716018@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

george young <gry(at)ll(dot)mit(dot)edu> writes:
> The question is: would I be better off losing all those integer ids
> and just using the text names as primary indices? Is there much
> performance lost comparing text strings for every index operation?

Strings would be slower, but possibly not by enough to notice. The
real question you should ask yourself is whether your text names are
really good candidates to be primary keys. Are there ever any
duplicates? Do you ever rename objects? If your answer to either
is "yes" then the names won't do as unique identifiers.

There's an old saying that meaningful keys are bad database design;
check the mailing list archives for some examples. (F'r instance,
I seem to recall a story about a bank that embedded branch numbers
into account numbers, and then had terrible troubles anytime a
customer moved...)

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message lz John 2002-10-16 03:11:42 hi
Previous Message 2000 Informática 2002-10-15 19:40:43 ADO with postgreSQL