X-Original-To: pgsql-performance@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0D16D474E5C for ; Tue, 11 Feb 2003 08:29:25 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 53A0F474E53 for ; Tue, 11 Feb 2003 08:29:24 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 18iaTX-0004Ia-00 for ; Tue, 11 Feb 2003 08:29:27 -0500 Date: Tue, 11 Feb 2003 08:29:27 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Message-ID: <20030211082927.C15541@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from jeandre@itvs.co.za on Tue, Feb 11, 2003 at 01:10:12PM +0200 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/51 X-Sequence-Number: 1107 On Tue, Feb 11, 2003 at 01:10:12PM +0200, jeandre@itvs.co.za wrote: > When defining data types, which is better text, varchar or char? I heard > that on Postgres text is better, but I know on Sybase char is more efficient. > Can someone please tell me whether this statement is true and if so why? Avoid char(n) unless you absolutely know you have a constant-length field. Even then, you may get surprises. For practical purposes, text is probably your best bet. For compatibility, there is varchar(), which is the same thing as text. If you need to limit the size, use varchar(n). Be aware that it is slightly slower, so don't use it unless your model demands it. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110