Search Postgresql Archives

Re: Character fields and length

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

 



Brandon Aiken wrote:

I know that in PostgreSQL, there is no performance difference between character and character varying.  

 

Is there any penalty in either performance or disk space for not specifying a length on char and varchar fields?  Is it really just there only as a basic check constraint for the logical model?

If you omit the length on a char field it will be char(1) .

Varchar without a length is basically a text type - it will accept strings of up to 1gb in size. 

varchar, text, and char fields have no performance differences (aside from the space padding stored in a char field - which takes up extra space).

Keep in mind that by limiting the size you can also prevent things like TOAST from being used (alternately, you could set the storage type on the column to prevent TOAST).

Chander Ganesan
Open Technology Group, Inc. - Expert PostgreSQL Training
One Copley Parkway, Suite 210
Morrisville, NC  27560
Phone: 877-258-8987/919-463-0999
http://www.otg-nc.com

 

--

Brandon Aiken

CS/IT Systems Engineer

 

Confidentiality Notice

This email, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed.  If the reader of this email is not the intended recipient or his/her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this email is prohibited.  If you have received this email in error, please notify the sender by replying to this message and deleting this email immediately.

 


[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