From: Eric BASIER <basier@ipgp.jussieu.fr>
To: JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>
To: PGSQL SQL <pgsql-sql@hub.org>
Subject: Re: [SQL] comparing 2 tables. . .
Date: Fri, 24 Sep 1999 16:32:00 +0200
Message-ID: <37EB8B5F.23F9CA40@ipgp.jussieu.fr> (raw)
References: <01BF066E.5FDF4460.jt-kirkpatrick@mpsllc.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: basier@ipgp.jussieu.fr, jt-kirkpatrick@mpsllc.com, pgsql-sql@hub.org
Subject: Re: [SQL] comparing 2 tables. . .
In-Reply-To: <37EB8B5F.23F9CA40@ipgp.jussieu.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox