pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Alvaro Herrera <alvherre@commandprompt.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pgsql performance <pgsql-performance@postgresql.org>
Cc: Mario Weilguni <mweilguni@sime.com>
Cc: Ow Mun Heng <Ow.Mun.Heng@wdc.com>
Subject: Re: Altering a column type - Most efficient way
Date: Fri, 11 Jul 2008 09:55:06 -0500
Message-ID: <48772E39.EE98.0025.0@wicourts.gov> (raw)
In-Reply-To: <3462.1215786454@sss.pgh.pa.us>
References: <1215676380.15319.2.camel@neuromancer.home.net>
	<4875C9FA.7020101@sime.com>
	<1215682481.15319.14.camel@neuromancer.home.net>
	<20080710135756.GD3757@alvh.no-ip.org>
	<1215742620.853.10.camel@neuromancer.home.net>
	<20080711134423.GA4110@alvh.no-ip.org>
	<20080711134423.GA4110@alvh.no-ip.org>
	<3462.1215786454@sss.pgh.pa.us>

>>> Tom Lane <tgl@sss.pgh.pa.us> wrote: 
> Alvaro Herrera <alvherre@commandprompt.com> writes:
>> Ow Mun Heng wrote:
>>> If it were this simple a change, I'm not certain why (I believe) PG
is
>>> checking each and every row to see if it will fit into the new
column
>>> definition/type. 
> 
>> Because the code that does the ALTER TYPE is very generic, and it
>> doesn't (yet) have an optimization that tells it to skip the check
and
>> the possible table rewrite in the cases where it's obviously not
needed
>> (like this one).
> 
> Awhile back I looked into teaching ALTER TYPE that it needn't
rewrite
> if the type conversion expression parses out as just a Var with
> RelabelType, but it seemed that that wouldn't cover very much of the
> use-cases where a human thinks that it's "obvious" that no rewrite
> is needed.
 
We wouldn't have to cover all possible cases for it to be useful.  If
there's some low-hanging fruit here, +1 for getting that.  The cases
which would most often save staff here some time are switching a
varchar to a longer maximum length or switching between a domain which
is varchar to plain varchar (or vice versa).
 
-Kevin



view thread (10+ messages)  latest in thread

Message-ID: <48772E39.EE98.0025.0@wicourts.gov>
Permalink:  ../48772E39.EE98.0025.0@wicourts.gov/
Also on:    postgresql.org/message-id/48772E39.EE98.0025.0@wicourts.gov

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, alvherre@commandprompt.com, tgl@sss.pgh.pa.us, mweilguni@sime.com, Ow.Mun.Heng@wdc.com
  Subject: Re: Altering a column type - Most efficient way
  In-Reply-To: <48772E39.EE98.0025.0@wicourts.gov>
  References: <1215676380.15319.2.camel@neuromancer.home.net> <4875C9FA.7020101@sime.com> <1215682481.15319.14.camel@neuromancer.home.net> <20080710135756.GD3757@alvh.no-ip.org> <1215742620.853.10.camel@neuromancer.home.net> <20080711134423.GA4110@alvh.no-ip.org> <3462.1215786454@sss.pgh.pa.us> <48772E39.EE98.0025.0@wicourts.gov>

* 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