Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 186BF9F9D02 for ; Mon, 13 Aug 2007 16:34:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 29260-09-2 for ; Mon, 13 Aug 2007 16:34:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 3EA949F9D13 for ; Mon, 13 Aug 2007 16:34:28 -0300 (ADT) Received: (qmail 14281 invoked by uid 0); 13 Aug 2007 19:34:26 -0000 Received: from 84.75.95.14 by www143.gmx.net with HTTP; Mon, 13 Aug 2007 21:34:26 +0200 (CEST) Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset="us-ascii" Date: Mon, 13 Aug 2007 21:34:27 +0200 From: "Christian Kindler" In-Reply-To: <46C0B01C.3020307@sprocks.gotdns.com> Message-ID: <20070813193427.76840@gmx.net> MIME-Version: 1.0 References: <1694202581-1187027999-cardhu_decombobulator_blackberry.rim.net-401169594-@bxe119.bisx.prod.on.blackberry> <46C0B01C.3020307@sprocks.gotdns.com> Subject: Re: Comparing two slices within one table efficiently To: Andrew Kroeger , ksimpson@mailchannels.com X-Authenticated: #27759442 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Priority: 3 X-Provags-ID: V01U2FsdGVkX19kkod2iahkOgwxd/l1i9iZyLl22H49xaK6W8jN8v GSrgHI91WCI496gPxqkX47kmho1nrucvfNGw== Content-Transfer-Encoding: 7bit X-GMX-UID: C/SmLGxoaHItQCjBgSQlo8diamdhZISS X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.253 tagged_above=0 required=5 tests=AWL=0.252, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200708/111 X-Sequence-Number: 29049 Yes and you could make it even more speedy with the use table partitioning. http://www.postgresql.org/docs/8.1/interactive/ddl-partitioning.html > select > t1.domain_id as domain_id, > t1.mta_id as mta_id, > t1.run_id as run_id_1, > t1.attribute1 as attribute1_1, > t1.attribute2 as attribute2_1, > t2.run_id as run_id_2, > t2.attribute1 as attribute1_2, > t2.attribute2 as attribute2_2 > from > t t1 > join t t2 on > t1.mta_id = t2.mta_id and > t1.domain_id = t2.domain_id and > (t1.attribute1 != t2.attribute1 or t1.attribute2 != t2.attribute2) -- cu Chris Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser