From: Andrew Dunstan <andrew@dunslane.net>
To: emilu@encs.concordia.ca
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: char(N), varchar(N), varchar, text
Date: Wed, 08 Oct 2014 10:30:11 -0400
Message-ID: <54354A73.6030607@dunslane.net> (raw)
In-Reply-To: <543548B4.4060700@encs.concordia.ca>
References: <543548B4.4060700@encs.concordia.ca>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
On 10/08/2014 10:22 AM, Emi Lu wrote:
> Good morning,
>
> For performance point of view, are there big differences between:
> char(N), varchar(N), varchar, text?
>
> Some comments from google shows:
> No difference, under the hood it's all varlena. Check this article
> from Depesz:
> http://www.depesz.com/index.php/2010/03/02/charx-vs-varcharx-vs-varchar-vs-text/
> A couple of highlights:
>
> To sum it all up:
>
> * char(n) – 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) – it's problematic to change the limit in live
> environment
> * varchar – just like text
> * text – for me a winner – over (n) data types because it lacks
> their problems, and over varchar – 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
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: andrew@dunslane.net, emilu@encs.concordia.ca
Subject: Re: char(N), varchar(N), varchar, text
In-Reply-To: <54354A73.6030607@dunslane.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox