pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: self join revisited
Date: Wed, 01 Apr 2009 20:41:49 +0200
Message-ID: <49D3B56D.9050802@zg.htnet.hr> (raw)
In-Reply-To: <7884.1238606350@sss.pgh.pa.us>
References: <49D3969F.4030701@zg.htnet.hr>
	<7884.1238606350@sss.pgh.pa.us>

Tom Lane wrote:
> Rikard Pavelic <rikard.pavelic@zg.htnet.hr> writes:
>   
>> It would be great if Postgres could rewrite this query
>>     
>
> AFAICS those queries are not going to produce the same results,
> so Postgres would be 100% incorrect to rewrite it like that for you.
>
> (If they do produce the same results, it would depend on a bunch
> of assumptions you have not stated.)
>
> 			regards, tom lane
>   

Can I try again? :)

How hard would it be to teach the planner about preserving uniqueness of
relations in subqueries?
And using that information to remove unnecessary self joins on unique sets?

I can try to rewrite some queries to test it on real data for how much
gain it would provide.

Regards,
Rikard



view thread (5+ messages)  latest in thread

Message-ID: <49D3B56D.9050802@zg.htnet.hr>
Permalink:  ../49D3B56D.9050802@zg.htnet.hr/
Also on:    postgresql.org/message-id/49D3B56D.9050802@zg.htnet.hr

 · 

reply

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-performance@postgresql.org
  Cc: rikard.pavelic@zg.htnet.hr, tgl@sss.pgh.pa.us
  Subject: Re: self join revisited
  In-Reply-To: <49D3B56D.9050802@zg.htnet.hr>

* 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