Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XbsFz-0000o2-6F for pgsql-performance@arkaria.postgresql.org; Wed, 08 Oct 2014 14:30:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XbsFy-0006Vo-IO for pgsql-performance@arkaria.postgresql.org; Wed, 08 Oct 2014 14:30:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XbsFx-0006VW-Nx for pgsql-performance@postgresql.org; Wed, 08 Oct 2014 14:30:21 +0000 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XbsFt-00005e-NQ for pgsql-performance@postgresql.org; Wed, 08 Oct 2014 14:30:20 +0000 Received: from mfilter6-d.gandi.net (mfilter6-d.gandi.net [217.70.178.135]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id 2F601FB8E9; Wed, 8 Oct 2014 16:30:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter6-d.gandi.net Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by mfilter6-d.gandi.net (mfilter6-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id bED4uvZsidOe; Wed, 8 Oct 2014 16:30:14 +0200 (CEST) X-Originating-IP: 98.27.58.255 Received: from [192.168.10.146] (cpe-098-027-058-255.nc.res.rr.com [98.27.58.255]) (Authenticated sender: adsend@dunslane.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 59BC1FB8D3; Wed, 8 Oct 2014 16:30:13 +0200 (CEST) Message-ID: <54354A73.6030607@dunslane.net> Date: Wed, 08 Oct 2014 10:30:11 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: emilu@encs.concordia.ca CC: "pgsql-performance@postgresql.org" Subject: Re: char(N), varchar(N), varchar, text References: <543548B4.4060700@encs.concordia.ca> In-Reply-To: <543548B4.4060700@encs.concordia.ca> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 10/08/2014 10:22 AM, Emi Lu wrote: > Good morning, > > For performance point of view, are there big differences between:=20 > char(N), varchar(N), varchar, text? > > Some comments from google shows: > No difference, under the hood it's all varlena. Check this article=20 > from Depesz:=20 > http://www.depesz.com/index.php/2010/03/02/charx-vs-varcharx-vs-varchar-v= s-text/ > A couple of highlights: > > To sum it all up: > > * char(n) =96 takes too much space when dealing with values > shorter than n, and can lead to subtle errors because of > adding trailing spaces, plus it is problematic to change the limit > * varchar(n) =96 it's problematic to change the limit in live > environment > * varchar =96 just like text > * text =96 for me a winner =96 over (n) data types because it lacks > their problems, and over varchar =96 because it has distinct name > > So, can I assume no big performance differences? > Thanks alot! > Emi > Why do you need to ask if you already have the answer? Depesz is right. cheers andrew --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance