Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CD90D476EFF for ; Fri, 1 Nov 2002 15:52:30 -0500 (EST) Received: from mta4.snet.net (mta4.snet.net [204.60.203.76]) by postgresql.org (Postfix) with ESMTP id 16A6D476EAF for ; Fri, 1 Nov 2002 15:52:30 -0500 (EST) Received: from pop.snet.net ([204.60.203.73]) by mta4.snet.net (8.12.3/8.12.3/SNET-mx-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id gA1Kq1Um019959; Fri, 1 Nov 2002 15:52:01 -0500 (EST) X-Originating-IP: [64.252.95.167] X-SBCIS-MTA: [pop.snet.net] Received: from [192.168.1.83] (167.95.252.64.snet.net [64.252.95.167]) by pop.snet.net (8.12.3/8.12.3/SNET-pop-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id gA1KqCH8023385; Fri, 1 Nov 2002 15:52:16 -0500 (EST) Subject: Re: Does this matter? From: Wei Weng To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org In-Reply-To: <200211011223.48962.josh@agliodbs.com> References: <1036181881.24810.1.camel@Monet> <200211011223.48962.josh@agliodbs.com> Content-Type: text/plain Organization: Message-Id: <1036183942.25096.3.camel@Monet> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.1.90 (Preview Release) Date: 01 Nov 2002 15:52:22 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/12 X-Sequence-Number: 170 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.