Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id CDBDA65003C for ; Sat, 5 Jul 2008 08:19:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 91323-07 for ; Sat, 5 Jul 2008 08:19:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from web56406.mail.re3.yahoo.com (web56406.mail.re3.yahoo.com [216.252.111.85]) by postgresql.org (Postfix) with SMTP id 35D4364FD34 for ; Sat, 5 Jul 2008 08:19:54 -0300 (ADT) Received: (qmail 68012 invoked by uid 60001); 5 Jul 2008 11:19:52 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=L5tbY0CNixA24No3wKlloqsvj+tVj5x02c3ojKvNthiQ3CfBCuiJd3IMt2KBVWZDYjIpiYzD+//yLm6UVFu+dViuQSfDM9sYpmZqywoK4/LuogLsqkQYyPAq9mHbQ2X+ulaH2dsXSIl9hL/3PAvo9b4fsLnz0BxIuAbollDASOU=; Received: from [98.166.112.215] by web56406.mail.re3.yahoo.com via HTTP; Sat, 05 Jul 2008 04:19:52 PDT X-Mailer: YahooMailRC/1042.33 YahooMailWebService/0.7.199 Date: Sat, 5 Jul 2008 04:19:52 -0700 (PDT) From: Jessica Richard Subject: performance cost for varchar(20), varchar(255), and text To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-530801136-1215256792=:60585" Message-ID: <801541.60585.qm@web56406.mail.re3.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200807/73 X-Sequence-Number: 29683 --0-530801136-1215256792=:60585 Content-Type: text/plain; charset=us-ascii I am tuning a database created by someone else. I noticed that some column lengths were defined longer than needed. For example, an Id column is holding a stand length of 20 characters but was defined as varchar(255). On some other columns, for example, a Description column is supposed to hold less than 100 characters but defined as text. I am trying to understand the performance impact if a column is over defined in the following cases: 1. char(20) vs varchar(20) 2. varchar(20) vs varchar(255) 3. varchar(255) vs text thanks, Jessica --0-530801136-1215256792=:60585 Content-Type: text/html; charset=us-ascii
I am tuning a database created by someone else.

I noticed that some column lengths were defined longer than needed.

For example, an Id column is holding a stand length of 20 characters but was defined as varchar(255).

On some other columns, for example, a Description column is supposed to hold less than 100 characters but defined as text.

I am trying to understand the performance impact if a column is over defined in the following cases:

1. char(20) vs varchar(20)

2. varchar(20) vs varchar(255)

3. varchar(255) vs text


thanks,
Jessica

--0-530801136-1215256792=:60585--