pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emi Lu <emilu@encs.concordia.ca>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: char(N), varchar(N), varchar, text
Date: Wed, 08 Oct 2014 10:42:55 -0400
Message-ID: <54354D6F.1080002@encs.concordia.ca> (raw)
In-Reply-To: <54354A73.6030607@dunslane.net>
References: <543548B4.4060700@encs.concordia.ca>
	<54354A73.6030607@dunslane.net>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>


>
>>
>> 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.
Good to hear this. Well, sorry I saw the time is:/2010/03 (might changes 
for diff/newer versions).

Thank you for the confirmation.
Emi



-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (3+ messages)

Message-ID: <54354D6F.1080002@encs.concordia.ca>
Permalink:  ../54354D6F.1080002@encs.concordia.ca/
Also on:    postgresql.org/message-id/54354D6F.1080002@encs.concordia.ca

 · 

reply

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: emilu@encs.concordia.ca, andrew@dunslane.net
  Subject: Re: char(N), varchar(N), varchar, text
  In-Reply-To: <54354D6F.1080002@encs.concordia.ca>

* 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