Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 461D69FBC79 for ; Fri, 27 Apr 2007 13:39:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 61197-06 for ; Fri, 27 Apr 2007 13:39:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from globalrelay.com (mail1.globalrelay.com [204.92.49.200]) by postgresql.org (Postfix) with ESMTP id 1E2299FBC7C for ; Fri, 27 Apr 2007 13:39:16 -0300 (ADT) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES X-Real-To: pgsql-performance@postgresql.org, sid@etsy.com Received: from [71.215.214.175] (HELO davedell) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 137787732; Fri, 27 Apr 2007 09:39:15 -0700 From: "Dave Dutcher" To: , References: <50444.209.51.183.100.1177687911.squirrel@mailbox.etsy.com> Subject: Re: How can fixed and variable width columns perform similarly? Date: Fri, 27 Apr 2007 11:40:15 -0500 Message-ID: <003801c788ea$bc7e5830$ca00a8c0@tridecap.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-reply-to: <50444.209.51.183.100.1177687911.squirrel@mailbox.etsy.com> thread-index: AceI5ORy7ssIZ3BpRC2vyjOP7OqKkAAA2ZyQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL=0.050, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200704/476 X-Sequence-Number: 24353 I think the manual is implying that if you store a value like "Sid" in a field either of type varchar(128) or type text there is no performance difference. The manual is not saying that you get the same performance storing a 500k text field as when you store the value "Sid". Dave -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Siddharth Anand Sent: Friday, April 27, 2007 10:32 AM To: pgsql-performance@postgresql.org Subject: [PERFORM] How can fixed and variable width columns perform similarly? Hi! I read the link below and am puzzled by or curious about something. http://www.postgresql.org/docs/8.1/interactive/datatype-character.html The Tip below is intriguing "Tip: There are no performance differences between these three types, apart from the increased storage size when using the blank-padded type. While character(n) has performance advantages in some other database systems, it has no such advantages in PostgreSQL. In most situations text or character varying should be used instead." How can a field that doesn't have a limit like "text" perform similarly to char varying(128), for example? At some point, we need to write data to disk. The more data that needs to be written, the longer the disk write will take, especially when it requires finding free sectors to write to. Another interesting quote from the same page is the following: "Long values are also stored in background tables so they do not interfere with rapid access to the shorter column values. " If the long values are stored in a separate table, on a different part of the disk, doesn't this imply an extra disk seek? Won't it therefore take longer? Sid ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend