Search Postgresql Archives

Re: varchar(n) vs. varchar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Daniel Serodio" <dserodio@xxxxxxxxx> writes:
> I've found a thread discussing the use of "text" vs. "varchar"; what
> I'd like to know if there's any performance difference between using
> "varchar(n)" vs. "varchar", ie, should I constrain a "name" column to
> an arbitrary length to improve performance, or will it actually degrade
> performance because of the extra cycles used for checking the length?

The latter.

The general rule of thumb is don't use varchar(n) (or even worse,
char(n)) unless you can point to a specific application requirement
for a maximum field width.  In particular, if you find yourself
picking a value for N out of the air, you're doing the wrong thing.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux