Thread: Size or efficiency differences "varchar(128) vs. varchar(32)"

Size or efficiency differences "varchar(128) vs. varchar(32)"

From
Emi Lu
Date:
Good morning,

I'd like to create a varchar length column.

May I know does varchar(128) and varchar(32) will cause any size or 
efficiency differences?

Thanks a lot!


Re: Size or efficiency differences "varchar(128) vs. varchar(32)"

From
Alvaro Herrera
Date:
Emi Lu wrote:

> May I know does varchar(128) and varchar(32) will cause any size or  
> efficiency differences?

None at all.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Size or efficiency differences "varchar(128) vs. varchar(32)"

From
"Scott Marlowe"
Date:
On Mon, Jul 21, 2008 at 8:06 AM, Emi Lu <emilu@encs.concordia.ca> wrote:
> Good morning,
>
> I'd like to create a varchar length column.
>
> May I know does varchar(128) and varchar(32) will cause any size or
> efficiency differences?

If you store the same thing in each, no.  If you store 128 char  text
in the varchar(128) it will of course be bigger than a 32 char text in
the varchar(32) field.


Re: Size or efficiency differences "varchar(128) vs. varchar(32)"

From
Emi Lu
Date:
Sorry, forgot to replay all.

> Emi Lu wrote:
> 
>> May I know does varchar(128) and varchar(32) will cause any size or  
>> efficiency differences?
> 
> None at all.


Basically, there is no efficiency differences at all, if I know a column 
is now varchar(32) but could be potentially increased to length(col)>32 
in the future, I will setup to varchar(128).

This column will be setup as varchar(128) everywhere so that foreign key 
constraints will work.

I had thought "foreign constraint, query or indexes" on varchar(32) 
could be more efficient than varchar(128) and I was wrong.

I will use varchar(128) for my column.

Thanks a lot!