Re: self join revisited

From: Rikard Pavelic <rikard(dot)pavelic(at)zg(dot)htnet(dot)hr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: self join revisited
Date: 2009-04-01 18:41:49
Message-ID: 49D3B56D.9050802@zg.htnet.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Tom Lane wrote:
> Rikard Pavelic <rikard(dot)pavelic(at)zg(dot)htnet(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Stef Telford 2009-04-01 19:51:35 Re: Raid 10 chunksize
Previous Message Matthew Wakeling 2009-04-01 18:27:19 Re: Very specialised query