Re: determining maxsize for character varying - Mailing list pgsql-performance

From Tom Lane
Subject Re: determining maxsize for character varying
Date
Msg-id 11149.1182006428@sss.pgh.pa.us
Whole thread Raw
In response to determining maxsize for character varying  (okparanoid@free.fr)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Ragnar
Date:
Subject: Re: determining maxsize for character varying
Next
From: "J6M"
Date:
Subject: Re: Database size