Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id ECC759FC000 for ; Fri, 27 Apr 2007 14:12:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 12775-09 for ; Fri, 27 Apr 2007 14:12:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 231259FBC45 for ; Fri, 27 Apr 2007 14:12:49 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l3RHClYs016455; Fri, 27 Apr 2007 13:12:47 -0400 (EDT) To: sid@etsy.com cc: pgsql-performance@postgresql.org Subject: Re: How can fixed and variable width columns perform similarly? In-reply-to: <50516.209.51.183.100.1177690744.squirrel@mailbox.etsy.com> References: <50444.209.51.183.100.1177687911.squirrel@mailbox.etsy.com> <15873.1177691157@sss.pgh.pa.us> <50516.209.51.183.100.1177690744.squirrel@mailbox.etsy.com> Comments: In-reply-to "Siddharth Anand" message dated "Fri, 27 Apr 2007 09:19:04 -0700" Date: Fri, 27 Apr 2007 13:12:47 -0400 Message-ID: <16453.1177693967@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/478 X-Sequence-Number: 24355 "Siddharth Anand" writes: > My question wasn't phrased clearly. Oracle exhibits a performance > degradation for very large-sized fields (CLOB types that I equate to > PostGres' text type) when compared with the performance of field types > like varchar that handle a max character limit of a few thousand bytes in > Oracle. > It sounds like PostGres doesn't exhibit this same difference. I wanted to > understand how this could be and whether there was a trade-off. Ah. Well, the answer is that we change behavior dynamically depending on the size of the particular field value, instead of hard-wiring it to the declared column type. It sounds like Oracle's CLOB might be doing about the same thing as an out-of-line "toasted" field value in Postgres. In PG, text and varchar behave identically except that varchar(N) adds an insert-time check on the length of the field value --- but this is just a constraint check and doesn't have any direct influence on how the value is stored. regards, tom lane