From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Daniel Serodio" <dserodio(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: varchar(n) vs. varchar |
Date: | 2006-08-22 21:26:54 |
Message-ID: | 11923.1156282014@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Daniel Serodio" <dserodio(at)gmail(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-08-22 21:35:47 | Re: [8.1.4] Create index on timestamp fails |
Previous Message | Don Isgitt | 2006-08-22 21:24:46 | pl/R problem |