pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
'IN' performance
2+ messages / 2 participants
[nested] [flat]

* 'IN' performance
@ 2001-12-17 06:33 Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  2001-12-17 06:44 ` Re: 'IN' performance Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Christopher Kings-Lynne @ 2001-12-17 06:33 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>; MindTerm <mindterm@yahoo.com>; pgsql-sql

> In the sub-select form, we pretty much suck: for each tuple in the outer
> query, we run the inner query until we find a matching value or the
> inner query ends.  This is basically a nested-loop scenario, with the
> only (minimally) redeeming social value being that the planner realizes
> it should pick a fast-start plan for the inner query.  I think it should
> be possible to convert this form into a modified kind of join (sort of
> the reverse of an outer join: rather than at least one result per
> lefthand row, at most one result per lefthand row), and then we could
> use join methods that are more efficient than nested-loop.  But no one's
> tried to make that happen yet.

That's what I was thinking...where abouts does all that activity happen?

I assume the planner knows that it doesn't have to reevaluate the subquery
if it's not correlated?

Chris




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: 'IN' performance
  2001-12-17 06:33 'IN' performance Christopher Kings-Lynne <chriskl@familyhealth.com.au>
@ 2001-12-17 06:44 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-12-17 06:44 UTC (permalink / raw)
  To: Christopher Kings-Lynne <chriskl@familyhealth.com.au>; +Cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>; MindTerm <mindterm@yahoo.com>; pgsql-sql

"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> That's what I was thinking...where abouts does all that activity happen?

The infrastructure for different join rules already exists.  There'd
need to be a new JOIN_xxx type added to the various join nodes in the
executor, but AFAICS that's just a minor extension.  The part that is
perhaps not trivial is in the planner.  All the existing inner and outer
join types start out expressed as joins in the original query.  To make
IN into a join, the planner would have to hoist up a clause from WHERE
into the join-tree structure.  I think it can be done, but I have not
thought hard about where and how, nor about what semantic restrictions
might need to be checked.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-12-17 06:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-12-17 06:33 'IN' performance Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2001-12-17 06:44 ` Tom Lane <tgl@sss.pgh.pa.us>

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