Thread: alter table on a large db

alter table on a large db

From
Zdravko Balorda
Date:
Hi,

I need to make some ALTER TABLEs. It takes about 30min to copy
this quite large databse, bat several ours to run a bunch of ALTER
TABLE statements.
Is there any way to make it faster? I wonder what could possibly alter 
table be doing all this time.

Regards, Zdravko.



Re: alter table on a large db

From
Achilleas Mantzios
Date:
Στις Thursday 19 March 2009 09:57:11 ο/η Zdravko Balorda έγραψε:
>
> Hi,
>
> I need to make some ALTER TABLEs. It takes about 30min to copy
> this quite large databse, bat several ours to run a bunch of ALTER
> TABLE statements.
> Is there any way to make it faster? I wonder what could possibly alter
> table be doing all this time.

Which version of postgresql do you use?
Also you might consider editing the SQL dump to alter
the DDL statements prior to loading it in your db.
batch editing sed, awk, perl, could help you on that...

>
> Regards, Zdravko.
>
>



--
Achilleas Mantzios


Re: alter table on a large db

From
Scott Marlowe
Date:
On Thu, Mar 19, 2009 at 1:57 AM, Zdravko Balorda
<zdravko.balorda@siix.com> wrote:
>
> Hi,
>
> I need to make some ALTER TABLEs. It takes about 30min to copy
> this quite large databse, bat several ours to run a bunch of ALTER
> TABLE statements.
> Is there any way to make it faster? I wonder what could possibly alter table
> be doing all this time.

Which alter table statements are you running in particular?  Most
alter table stuff runs pretty quickly, like adding a column and such.
Just wondering.


Re: alter table on a large db

From
Jasen Betts
Date:
On 2009-03-19, Zdravko Balorda <zdravko.balorda@siix.com> wrote:
>
> Hi,
>
> I need to make some ALTER TABLEs. It takes about 30min to copy
> this quite large databse, bat several ours to run a bunch of ALTER
> TABLE statements.

which do you prefer 30 minutes down-time to reload the database or a
few hours wait to update it live.

> Is there any way to make it faster? I wonder what could possibly alter 
> table be doing all this time.

drop and reload the table?