pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: okparanoid@free.fr
Cc: pgsql-performance@postgresql.org
Subject: Re: determining maxsize for character varying
Date: Sat, 16 Jun 2007 11:07:08 -0400
Message-ID: <11149.1182006428@sss.pgh.pa.us> (raw)
In-Reply-To: <1181987590.4673b306d4baf@imp.free.fr>
References: <1181987590.4673b306d4baf@imp.free.fr>

okparanoid@free.fr writes:
> Hello i would like to know if not determining a max size value for a
> character varying's fields decrease the perfomance (perhaps size of
> stockage ?

No, more the other way around: specifying varchar(N) when you had to
pick N out of the air decreases performance, because of all the
essentially useless checks of the string length that Postgres has to
make.  If you cannot defend a specific limit N as being required by your
application, then just make it unconstrained varchar (or better text).

Do *not* use char(N) for data with highly variable width; that one
definitely will cost you performance and disk space.

			regards, tom lane



view thread (5+ messages)

Message-ID: <11149.1182006428@sss.pgh.pa.us>
Permalink:  ../11149.1182006428@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11149.1182006428@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, okparanoid@free.fr
  Subject: Re: determining maxsize for character varying
  In-Reply-To: <11149.1182006428@sss.pgh.pa.us>

* 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