Re: Newbee question "Types" - Mailing list pgsql-general

From Josh Berkus
Subject Re: Newbee question "Types"
Date
Msg-id web-2023225@davinci.ethosmedia.com
Whole thread Raw
In response to Newbee question "Types"  ("Ken Godee" <ken@perfect-image.com>)
Responses Re: Newbee question "Types"
List pgsql-general
Ken,

1. Using column type "char" vs "varchar" vs "text"
   I understand the documented differences, but Why wouldn't
   someone just use varchar(x) instead of plain char(x)? It's
   definitely more flexable. Or would using char(x) just help one
   stay in sql conformity? How about performance differences?
   Disk space differences? Would not varchar(45) vs char(45)
   consume less space if used with less than 45 characters?

In postgresql, CHAR is supplied for 3 reasons:
1) For compatibility with other database systems that use CHAR.
2) For SQL99 Compliance
3) For compatibility with software that expects space-filled CHAR
fields.

For a Postgres-native application, there is no reason to ever use CHAR.
 It does not perform any better, and can lead to significant annoyance.

-Josh Berkus

pgsql-general by date:

Previous
From: "David Blood"
Date:
Subject: Re: Size for vacuum_mem
Next
From: Joe Conway
Date:
Subject: Re: the "/usr/local/pgsql/data" directory size