From: Tom Lane <tgl@sss.pgh.pa.us>
To: gry@ll.mit.edu
Cc: pgsql-sql@postgresql.org
Subject: Re: int id's helpful for indexing, or just use text names?
Date: Tue, 15 Oct 2002 17:06:58 -0400
Message-ID: <18502.1034716018@sss.pgh.pa.us> (raw)
In-Reply-To: <20021015151647.65521b8d.gry@ll.mit.edu>
References: <20021015151647.65521b8d.gry@ll.mit.edu>
george young <gry@ll.mit.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, gry@ll.mit.edu
Subject: Re: int id's helpful for indexing, or just use text names?
In-Reply-To: <18502.1034716018@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox