Re: ALTER TABLE hangs

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Mike Baker <bakerlmike(at)yahoo(dot)com>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: ALTER TABLE hangs
Date: 2002-05-02 17:12:23
Message-ID: 20020502101023.Q49492-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, 2 May 2002, Mike Baker wrote:

>
> > > 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

Doing the set of CREATE CONSTRAINT TRIGGERS will be
faster (although it'll assume that the data meets
the constraint). You can probably get the necessary
lines by making another database with the same table
names and the constraint.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message MG 2002-05-02 20:27:31 ALTER TABLE for field modify...
Previous Message Judy Jecelin 2002-05-02 17:07:27 which replication?