Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 6460D476526 for ; Thu, 2 May 2002 13:50:30 -0400 (EDT) Received: from web13804.mail.yahoo.com (web13804.mail.yahoo.com [216.136.175.14]) by postgresql.org (Postfix) with SMTP id 94749476472 for ; Thu, 2 May 2002 12:30:48 -0400 (EDT) Message-ID: <20020502163052.38097.qmail@web13804.mail.yahoo.com> Received: from [65.101.243.177] by web13804.mail.yahoo.com via HTTP; Thu, 02 May 2002 09:30:52 PDT Date: Thu, 2 May 2002 09:30:52 -0700 (PDT) From: Mike Baker Subject: Re: ALTER TABLE hangs To: Stephan Szabo Cc: pgsql-admin@postgresql.org In-Reply-To: <20020429134741.S65313-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200205/9 X-Sequence-Number: 4184 > > 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