pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: sid@etsy.com
Cc: pgsql-performance@postgresql.org
Subject: Re: How can fixed and variable width columns perform similarly?
Date: Fri, 27 Apr 2007 13:12:47 -0400
Message-ID: <16453.1177693967@sss.pgh.pa.us> (raw)
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>

"Siddharth Anand" <sid@etsy.com> 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



view thread (5+ messages)

Message-ID: <16453.1177693967@sss.pgh.pa.us>
Permalink:  ../16453.1177693967@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16453.1177693967@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sid@etsy.com
  Subject: Re: How can fixed and variable width columns perform similarly?
  In-Reply-To: <16453.1177693967@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox