Re: [PERFORM] Text/Varchar performance...

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Cc: "Cristian Prieto" <cristian(at)clickdiario(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: [PERFORM] Text/Varchar performance...
Date: 2005-10-05 19:00:48
Message-ID: 200510051200.48515.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

Cristian,

> Hello, just a little question, It's preferable to use Text Fields or
> varchar(255) fields in a table? Are there any performance differences in
> the use of any of them?

TEXT, VARCHAR, and CHAR use the same underlying storage mechanism. This
means that TEXT is actually the "fastest" since it doesn't check length or
space-pad. However, that's unlikely to affect you unless you've millions
of records; you should use the type which makes sense given your
application.

For "large text fields" I always use TEXT. BTW, in PostgreSQL VARCHAR is
not limited to 255; I think we support up to 1GB of text or something
preposterous.

--
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bricklen Anderson 2005-10-05 19:05:47 Re: Problems with group by ... order by
Previous Message John D. Burger 2005-10-05 18:43:40 Problems with group by ... order by

Browse pgsql-performance by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2005-10-05 19:43:54 Re: [PERFORM] A Better External Sort?
Previous Message Merlin Moncure 2005-10-05 18:35:37 Re: Ultra-cheap NVRAM device