From: | Emi Lu <emilu(at)encs(dot)concordia(dot)ca> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: char(N), varchar(N), varchar, text |
Date: | 2014-10-08 14:42:55 |
Message-ID: | 54354D6F.1080002@encs.concordia.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-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
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2014-10-10 11:16:08 | Re: Yet another abort-early plan disaster on 9.3 |
Previous Message | Andrew Dunstan | 2014-10-08 14:30:11 | Re: char(N), varchar(N), varchar, text |