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

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: 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-15 00:24:19
Message-ID: jmd4fj$jjp$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2012-04-13, Jeff Adams <jeff(dot)adams(at)noaa(dot)gov> wrote:
> --e89a8ff1c1e8d37deb04bd922a84
> Content-Type: text/plain; charset=ISO-8859-1
>
> Thanks for the ideas Steve. I am actually working with a partitioned table
> and the field I am modifying is the id field (I have reached the cap on the
> integer data type and need to modify it to bigint - very poor planning on
> my part!), but no related tables exist. The id field in the partitioned
> tables is inherited, so I figured I needed to alter the column in the
> parent table. Does this information point towards an optimal solution?
> Thanks again...

you can drop the inheritance and alter the tables one at a time, I did
this on a partitioned table with only millions of rows when I saw
what direction it was going in.

As my data was partitioned by time the system had to run without some
of the older data for a while while my script altered and re-inherited
each partition.

--
⚂⚃ 100% natural

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2012-04-15 00:27:33 Re: Writing data to a text file based on a trigger event...
Previous Message Jasen Betts 2012-04-14 22:54:20 Re: efficient trigger function selection?