Re: ALTER TABLE hangs - Mailing list pgsql-admin

From Mike Baker
Subject Re: ALTER TABLE hangs
Date
Msg-id 20020502163052.38097.qmail@web13804.mail.yahoo.com
Whole thread Raw
In response to Re: ALTER TABLE hangs  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: ALTER TABLE hangs
List pgsql-admin
> > Hi.
> >
> > I am in the process of doing some data migration.
> I
> > have had no trouble moving my data, but am having
> > problems creating a foreign key.
> >
> > When I run the following command, psql hangs
> (well,
> > not totally sure if it is hung).
>
> It probably isn't hung, but it's going to go through
> every row of the table to make sure the constraint
> holds
> successfully which is going to result in 380,000
> queries again t_release_component. I haven't had
> time
> recently to do any of the fk stuff I've been meaning
> to
> do, but this is optimizable for most cases, but it
> hasn't
> been done.

This is true, the process was not hung, however, it
took 24 hrs to create this one foreign key.

Is there any other way to create the foriegn key, as
the next time i go through this process the table may
have up to 1 million records.

would CREATE TRIGGER be faster?  i cannot have my
production database down for a week while i create a
foreign key.

thanks for your help.

mike baker


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

pgsql-admin by date:

Previous
From: Hal Lynch
Date:
Subject: Authentication in batch processing
Next
From: Stephan Szabo
Date:
Subject: Re: ALTER TABLE hangs