X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CE480DA283; Wed, 5 Oct 2005 15:56:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09817-05; Wed, 5 Oct 2005 18:56:56 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 3C310DA282; Wed, 5 Oct 2005 15:56:56 -0300 (ADT) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 8206200; Wed, 05 Oct 2005 11:59:21 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Text/Varchar performance... Date: Wed, 5 Oct 2005 12:00:48 -0700 User-Agent: KMail/1.8 Cc: "Cristian Prieto" , pgsql-general@postgresql.org References: <20051005182803.0E6B0100E5@mail.clickdiario.com> In-Reply-To: <20051005182803.0E6B0100E5@mail.clickdiario.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510051200.48515.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.046 required=5 tests=[AWL=-0.004, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/205 X-Sequence-Number: 84434 Cristian, > Hello, just a little question, It's preferable to use Text Fields or > varchar(255) fields in a table? Are there any performance differences in > the use of any of them? TEXT, VARCHAR, and CHAR use the same underlying storage mechanism. This means that TEXT is actually the "fastest" since it doesn't check length or space-pad. However, that's unlikely to affect you unless you've millions of records; you should use the type which makes sense given your application. For "large text fields" I always use TEXT. BTW, in PostgreSQL VARCHAR is not limited to 255; I think we support up to 1GB of text or something preposterous. -- --Josh Josh Berkus Aglio Database Solutions San Francisco