Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 7599F632266 for ; Thu, 27 May 2010 13:20:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 53687-04 for ; Thu, 27 May 2010 16:19:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hermes.vectorsf.com (firewall.vectorsf.com [62.82.80.62]) by mail.postgresql.org (Postfix) with ESMTP id 1A05F6325EF for ; Thu, 27 May 2010 13:19:55 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by hermes.vectorsf.com (Postfix) with ESMTP id 27F032480011; Thu, 27 May 2010 18:19:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at hermes.vectorsf.com Received: from hermes.vectorsf.com ([127.0.0.1]) by localhost (hermes.vectorsf.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5jVS+8L6ULWS; Thu, 27 May 2010 18:19:46 +0200 (CEST) Received: from [10.70.4.200] (unknown [10.70.4.200]) (Authenticated sender: imartinez) by hermes.vectorsf.com (Postfix) with ESMTP id C831711C027B; Thu, 27 May 2010 18:19:46 +0200 (CEST) Subject: Re: How to add constraints without validating data. From: =?ISO-8859-1?Q?I=F1igo?= Martinez Lasala To: Nilesh Govindarajan Cc: Amit jain , pgsql-admin@postgresql.org In-Reply-To: References: <4BFE64D4.4020107@synechron.com> <1274976054.19383.37.camel@deimos> Content-Type: multipart/alternative; boundary="=-F0X791O7OdEgbw/aWyW+" Date: Thu, 27 May 2010 18:19:49 +0200 Message-ID: <1274977189.19383.51.camel@deimos> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.791 tagged_above=-10 required=5 tests=BAYES_50=0.8, HTML_MESSAGE=0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/267 X-Sequence-Number: 34740 --=-F0X791O7OdEgbw/aWyW+ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Constraints are special triggers, but triggers anyway. So, If you truncate the table, create the contraint and then restore with triggers disabled, it could be faster that create the contraint and wait until it checks all table data... or not... :) -----Original Message----- From: Nilesh Govindarajan To: IƱigo Martinez Lasala Cc: Amit jain , pgsql-admin@postgresql.org Subject: Re: [ADMIN] How to add constraints without validating data. Date: Thu, 27 May 2010 21:45:25 +0530 How would disabling triggers help that ? He just wants to add constraints without loss of data. I don't think he has any triggers. --=-F0X791O7OdEgbw/aWyW+ Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit Constraints are special triggers, but triggers anyway.

So, If you truncate the table, create the contraint and then restore with triggers disabled, it could be faster that create the contraint and wait until it checks all table data... or not... :)



-----Original Message-----
From: Nilesh Govindarajan <lists@itech7.com>
To: Iñigo Martinez Lasala <imartinez@vectorsf.com>
Cc: Amit jain <amitjain@synechron.com>, pgsql-admin@postgresql.org
Subject: Re: [ADMIN] How to add constraints without validating data.
Date: Thu, 27 May 2010 21:45:25 +0530

How would disabling triggers help that ? He just wants to add
constraints without loss of data. I don't think he has any triggers.


--=-F0X791O7OdEgbw/aWyW+--