Re: Updating pg_attribute to change field's data type from integer to bigint on very large table

From: Bèrto ëd Sèra <berto(dot)d(dot)sera(at)gmail(dot)com>
To: Jeff Adams <jeff(dot)adams(at)noaa(dot)gov>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Updating pg_attribute to change field's data type from integer to bigint on very large table
Date: 2012-04-13 16:05:34
Message-ID: CAKwGa_9Ruv+ZvM0eQsZyP7=VYCTKb3M6XhTKpKtAS48wra7YYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Jeff,

read carefully, he said it does stuff ON DISK, which means that all of your
fields must be physically remade (so it a lot more than telling it "it's an
int4, Sheila", which is what just modifying the catalog would do). Since
you are not a dba be aware that you are producing a new record for each of
the existing ones, and thus bloating things quite a bit. You may want to
vacuum it asap :)

Bèrto

On 13 April 2012 16:30, Jeff Adams <jeff(dot)adams(at)noaa(dot)gov> wrote:

> so i can? if so, how do i go about? i should mention that, while i dabble
> in postgres dba activity, it is not my day job...
>
>
> On Fri, Apr 13, 2012 at 11:27 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> I wrote:
>> > No, that is an actual on-disk change (making the field physically
>> > wider), so it's going to cost ya. There are some cases where the
>> > on-disk representation doesn't change and so a catalog update isn't
>> > needed, but int4->int8 isn't one of them.
>>
>> Sheesh, hit send too quickly on that. Of course I meant "and so a
>> catalog update is all that's needed".
>>
>> regards, tom lane
>>
>
>
>
> --
> Jeffrey D. Adams
> National Marine Fisheries Service
> Office of Protected Resources
> 1315 East West Hwy, Building SSMC3
> Silver Spring, MD 20910-3282
> phone: (301) 427-8434
> fax: (301) 713-0376
>

--
==============================
If Pac-Man had affected us as kids, we'd all be running around in a
darkened room munching pills and listening to repetitive music.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2012-04-13 16:31:16 Re: Updating pg_attribute to change field's data type from integer to bigint on very large table
Previous Message Jeff Adams 2012-04-13 15:30:11 Re: Updating pg_attribute to change field's data type from integer to bigint on very large table