pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-performance@postgresql.org
Cc: Cristian Prieto <cristian@clickdiario.com>
Cc: pgsql-general@postgresql.org
Subject: Re: [PERFORM] Text/Varchar performance...
Date: Wed, 5 Oct 2005 12:00:48 -0700
Message-ID: <200510051200.48515.josh@agliodbs.com> (raw)
In-Reply-To: <20051005182803.0E6B0100E5@mail.clickdiario.com>
References: <20051005182803.0E6B0100E5@mail.clickdiario.com>

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



view thread (5+ messages)  latest in thread

Message-ID: <200510051200.48515.josh@agliodbs.com>
Permalink:  ../200510051200.48515.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200510051200.48515.josh@agliodbs.com

 · 

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: josh@agliodbs.com, cristian@clickdiario.com, pgsql-general@postgresql.org
  Subject: Re: [PERFORM] Text/Varchar performance...
  In-Reply-To: <200510051200.48515.josh@agliodbs.com>

* 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