Re: Turn correlated in subquery into join

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
Cc: PostgreSQL Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Turn correlated in subquery into join
Date: 2008-03-24 16:30:11
Message-ID: 4995.1206376211@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org> writes:
> Look like the mysql people found a subquery that postgresql doesn't
> handle as good as possible:

> http://s.petrunia.net/blog/

> Is there some deeper issue here that I fail to see or is it simply that
> it hasn't been implemented but is fairly straigt forward?

I don't think it's straightforward: you'd need to do some careful
analysis to prove under what conditions such a transformation would be
safe. If the answer is "always, it doesn't matter what the correlation
condition is" then the actual implementation would probably not be
tremendously difficult. If there are restrictions then checking whether
the restrictions hold could be interesting ...

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Bruce Momjian 2008-03-24 17:44:08 Re: FW: was [PERFORM] partitioned table and ORDER BY indexed_field DESC LIMIT 1
Previous Message PFC 2008-03-24 13:20:56 Re: waiting for harddisk