Skip site navigation (1) Skip section navigation (2)

Re: determining maxsize for character varying

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: okparanoid(at)free(dot)fr
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: determining maxsize for character varying
Date: 2007-06-16 15:07:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
okparanoid(at)free(dot)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

In response to

pgsql-performance by date

Next:From: J6MDate: 2007-06-18 08:39:15
Subject: Re: Database size
Previous:From: RagnarDate: 2007-06-16 12:30:20
Subject: Re: determining maxsize for character varying

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group