Re: alter table is taking a long time

From: "stanciutheone(at)gmail(dot)com" <stanciutheone(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: alter table is taking a long time
Date: 2009-11-07 07:58:43
Message-ID: 5debd298-2859-41a2-9624-e17ce2b695b3@g23g2000yqh.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

is just a varchar field that i want to make it bigge ,right now the
alter table is working for over 6 hours

On 7 nov., 08:41, michael(dot)har(dot)(dot)(dot)(at)ericsson(dot)com ("Michael Harris")
wrote:
> Hi,
>
> I recently had to do something similar: change one column from INT to BIGINT in a table which has inherited to a depth of 3 and where some of the child tables had millions of records.
>
> All affected tables have to be rewritten for such a command. One consequence of this is that you (temporarily) need up to twice the amount of disk space that the tables are currently occupying. Another is that it takes a long time - for me I ran it overnight and it took at least 6 hours. Of course it depends on your hardware.
>
> I could not find any way to check on the progress of this query .. maybe someone else can help with that.
>
> I would not recommend restarting postgres. Can't you just cancel the query (control-C on psql if that is how you sent the command) or failing that send the postgresql backend process a SIGINT (not the master backend of course, the postgres backend that is executing the ALTER command)? It should roll back to the state as before the command was entered.
>
> Regards // Mike
>
> -----Original Message-----
> From: stanciuthe(dot)(dot)(dot)(at)gmail(dot)com [mailto:stanciuthe(dot)(dot)(dot)(at)gmail(dot)com]
> Sent: Saturday, 7 November 2009 4:55 PM
> To: pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org
> Subject: Re: alter table is taking a long time
>
> There is no one that can tell me what i can do here, or they will do
> here
>
> I'm thinking to restart postgrsql but what will happen with my table
> that i'm just altering just a filter
>
> On Nov 7, 2:38 am, "stanciuthe(dot)(dot)(dot)(at)gmail(dot)com" <stanciuthe(dot)(dot)(dot)(at)gmail(dot)com>
> wrote:
> > Hi
> > i have main table where and that table i have inherited 64 times, but
> > today i needed some extra space to a column so i have run an alter
> > table to one of my columns
>
> > the query is running for over 4 hours and i don't have a clue when it
> > will stop, the storage of this 64 table has around 30 and milions of
> > records,
>
> > Any advices on what i should need to do next,
>
> > Regards
>
> --
> Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message stanciutheone@gmail.com 2009-11-07 08:18:42 Re: alter table is taking a long time
Previous Message David Fetter 2009-11-07 06:42:03 Re: How to import data from Oracle and SqlServer to a Postgres database?