From: Wei Weng <wweng@kencast.com>
To: josh@agliodbs.com
Cc: pgsql-performance@postgresql.org
Subject: Re: Does this matter?
Date: 01 Nov 2002 15:52:22 -0500
Message-ID: <1036183942.25096.3.camel@Monet> (raw)
In-Reply-To: <200211011223.48962.josh@agliodbs.com>
References: <1036181881.24810.1.camel@Monet>
<200211011223.48962.josh@agliodbs.com>
Josh:
Since I need to use a GUID as the primary key, I have to use the char
datatype.
On Fri, 2002-11-01 at 15:23, Josh Berkus wrote:
> Wei,
>
> > Does it make a performance difference if I use a char(20) or a char(36)
> > as the primary key? My thought is no, but I would like to hear more
> > opinions.
>
> Yes, it does, though probably minor unless you have millions of records. CHAR
> is padded out to the specified length. Therefore the index on a char(36)
> column will be a little larger, and thus a little slower, than the char(20).
Does it affect the INSERT/UPDATE/DELETE operations on tables or simply
the SELECT operation or both?
>
> Now, there would be no difference between VARCHAR(20) and VARCHAR(36) unless
> you used some of the extra 16 characters on most rows.
>
> Either way, for tables of a few thousand records, I doubt that you'll notice
> the difference. BTW, why not use a SERIAL value as a surrogate primary key?
>
> > And a little further off topic(since we have many database experts
> > here), does it matter on MS SQL server 7?
>
> Yes, same reason.
--
Wei Weng
Network Software Engineer
KenCast Inc.
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: wweng@kencast.com, josh@agliodbs.com, pgsql-performance@postgresql.org
Subject: Re: Does this matter?
In-Reply-To: <1036183942.25096.3.camel@Monet>
* 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