Re: Comparing two slices within one table efficiently

From: "Christian Kindler" <christian(dot)kindler(at)gmx(dot)net>
To: Andrew Kroeger <andrew(at)sprocks(dot)gotdns(dot)com>, ksimpson(at)mailchannels(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Comparing two slices within one table efficiently
Date: 2007-08-13 19:34:27
Message-ID: 20070813193427.76840@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2007-08-13 19:37:40 Re: Comparing two slices within one table efficiently
Previous Message Christian Kindler 2007-08-13 19:29:52 how to moce back in refcursor