Re: Datatypes and performance

From: "Maksim Likharev" <mlikharev(at)aurigin(dot)com>
To: "Alvaro Herrera" <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: "PostgreSQL List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Datatypes and performance
Date: 2003-07-05 01:57:04
Message-ID: 56510AAEF435D240958D1CE8C6B1770A016D2D8F@mailc03.aurigin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ok, then if I store 4K - 1byte in a varchar and after that 4K + 1 byte,
and again and again, you are saying me that my text will be jerking
around 2 tables?
So in reality no performance degradation/benefits for varchar vs text,
should be read as 'varchar as slow as text' or keep you varchar under 4K
if you want to read it fast.

Pretty useful detail, thank you.

-----Original Message-----
From: Alvaro Herrera [mailto:alvherre(at)dcc(dot)uchile(dot)cl]
Sent: Friday, July 04, 2003 2:54 PM
To: Maksim Likharev
Cc: PostgreSQL List
Subject: Re: [GENERAL] Datatypes and performance

On Fri, Jul 04, 2003 at 02:22:39PM -0700, Maksim Likharev wrote:
> Ok, what I see here tells me that text is slower then fixed len
varchar,
> due to stored in separate table ( but how else you can store long
fields
> ).
> so postgres has to read another page(s) in order to get long value.

That's regardless of the datatype: a varchar longer than 2 KiB IIRC will
be stored in a separate table, just as a text longer than 2 KiB.
There's no difference _at all_ for those two datatypes _except_ that the
former is checked for maximum length. If you store 256 chars in a TEXT
field it will be in the main table as it were a varchar(256).

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Nunca confiaré en un traidor. Ni siquiera si el traidor lo he creado
yo"
(Barón Vladimir Harkonnen)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-07-05 03:12:59 Re: Datatypes and performance
Previous Message nolan 2003-07-05 00:59:16 Tables larger than 1GB