Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA17495 for ; Fri, 24 Sep 1999 10:33:05 -0400 (EDT) (envelope-from basier@ipgp.jussieu.fr) Received: from toutatis.ipgp.jussieu.fr (root@toutatis.ipgp.jussieu.fr [134.157.26.27]) by shiva.jussieu.fr (8.9.3/jtpda-5.3.2) with ESMTP id QAA13911 ; Fri, 24 Sep 1999 16:32:01 +0200 (CEST) Received: from sismo1.ipgp.jussieu.fr (sismo1.ipgp.jussieu.fr [134.157.27.131]) by toutatis.ipgp.jussieu.fr (8.9.3/jtpda-5.3.1) with ESMTP id QAA04685 ; Fri, 24 Sep 1999 16:29:05 +0200 (MET DST) Received: from ipgp.jussieu.fr (geosp5 [134.157.27.5]) by sismo1.ipgp.jussieu.fr (8.8.8/jtpda-5.2) with ESMTP id QAA22064 ; Fri, 24 Sep 1999 16:33:46 +0200 (MET DST) Sender: basier@ipgp.jussieu.fr Message-ID: <37EB8B5F.23F9CA40@ipgp.jussieu.fr> Date: Fri, 24 Sep 1999 16:32:00 +0200 From: Eric BASIER X-Mailer: Mozilla 4.02 [en] (X11; I; SunOS 5.6 sun4m) MIME-Version: 1.0 To: JT Kirkpatrick , PGSQL SQL Subject: Re: [SQL] comparing 2 tables. . . References: <01BF066E.5FDF4460.jt-kirkpatrick@mpsllc.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, You can try this, (but i think it may take a long time ) 1 : Find which tuples are in t1 and not in t2 select distinct t1.pk from t1 where t1.pk not in (select t2.pk from t2); 2 : Find which tuples are in t2 and not in t1 select distinct t2.pk from t2 where t2.pk not in (select t1.pk from t1); In the case that you only want to known the references If you want to rebuilt your table after analyze you can make this : select distinct t1.pk into t1b from t1 where t1.pk not in (select t2.pk from t2); select distinct t2.pk into t2b from t2 where t2.pk not in (select t1.pk from t1); After your analyze you can insert tuples of table t1b into table t1 and tuples of table t2b into table t2. Regards -- Basier Eric e-mail : basier@ipgp.jussieu.fr http://geoscope.ipgp.jussieu.fr IPGP Observatoires Sismologie-Volcanologie 4,Place Jussieu 75005 Paris Tour 24-14 4eme Etage Tel 01 44 27 38 96