Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2MF5qt75012 for ; Thu, 22 Mar 2001 10:05:52 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f2MF5b625822; Thu, 22 Mar 2001 10:05:37 -0500 (EST) To: "Martin A. Marques" cc: Stephan Szabo , pgsql-sql@postgresql.org Subject: Re: CHAR or VARCHAR In-reply-to: <01032208051900.07158@math.unl.edu.ar> References: <01032208051900.07158@math.unl.edu.ar> Comments: In-reply-to "Martin A. Marques" message dated "Thu, 22 Mar 2001 08:05:19 -0300" Date: Thu, 22 Mar 2001 10:05:37 -0500 Message-ID: <25819.985273537@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200103/449 X-Sequence-Number: 2117 "Martin A. Marques" writes: > How does performace look when doing lots of searches on a VARCHAR > column with respect of a CHAR column? That is my main concern. There is *no* performance advantage of CHAR(n) over VARCHAR(n). If anything, there is a performance lossage due to extra disk I/O (because all those padding blanks take space, and time to read). My advice is to use CHAR(n) when that semantically describes your data (ie, truly fixed-width data, like US postal codes), or VARCHAR(n) when that semantically describes your data (ie, variable-width with a hard upper bound), or TEXT when that semantically describes your data (ie, variable width with no specific upper bound). Worrying about performance differences is a waste of time, because there aren't any. regards, tom lane