Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C822D650739 for ; Thu, 10 Jul 2008 23:17:08 -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 06226-06 for ; Thu, 10 Jul 2008 23:16:58 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wdscexfe02.sc.wdc.com (wdscexfe02.sc.wdc.com [129.253.170.52]) by postgresql.org (Postfix) with ESMTP id 4DE18650727 for ; Thu, 10 Jul 2008 23:17:05 -0300 (ADT) Received: from wdmyexbe03.my.asia.wdc.com ([129.253.105.55]) by wdscexfe02.sc.wdc.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 10 Jul 2008 19:16:37 -0700 Received: from 129.253.110.56 ([129.253.110.56]) by wdmyexbe03.my.asia.wdc.com ([129.253.105.55]) with Microsoft Exchange Server HTTP-DAV ; Fri, 11 Jul 2008 02:16:33 +0000 Received: from neuromancer by 129.253.105.55; 11 Jul 2008 10:17:00 +0800 Subject: Re: Altering a column type - Most efficient way From: Ow Mun Heng To: Alvaro Herrera Cc: Mario Weilguni , Pgsql performance In-Reply-To: <20080710135756.GD3757@alvh.no-ip.org> 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> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 11 Jul 2008 10:17:00 +0800 Message-Id: <1215742620.853.10.camel@neuromancer.home.net> Mime-Version: 1.0 X-Mailer: Evolution 2.22.0 X-OriginalArrivalTime: 11 Jul 2008 02:16:37.0057 (UTC) FILETIME=[259A6310:01C8E2FC] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/94 X-Sequence-Number: 30694 On Thu, 2008-07-10 at 09:57 -0400, Alvaro Herrera wrote: > Ow Mun Heng wrote: > > > This is what I see on the table > > > > NEW attypmod = -1 > > OLD attypmod = 8 > > 8 means varchar(4) which is what you said you had (4+4) > -1 means unlimited size. > This is cool. 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. Thus, I'm still a bit hesitant to do the change, although it is definitely a very enticing thing to do. ( I presume also that this change will be instantaneous and does not need to check on each and every row of the table?) Thanks./