Re: left-deep plans?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: left-deep plans?
Date: 2005-02-22 06:04:20
Message-ID: 5859.1109052260@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway <neilc(at)samurai(dot)com> writes:
> Presently the planner considers left-deep, right-deep, and bushy plans
> (i.e. it will consider plans in which the outer operand of a join is a
> join, the inner operand is a join, or both operands are joins). It is a
> fairly standard heuristic in the literature to restrict the search to
> left-deep plans, on the grounds that this significantly reduces the set
> of plans to consider, and the more efficient plans are _usually_ found
> in the set of left-deep plans (since we can do pipelining more
> efficiently). Has there been any thought about applying this optimization?

Yes, and it's been rejected. The notion is obviously bogus; it amounts
to assuming that every database is a star schema with only one core table.

The left-deep vs right-deep case is more tricky, since on its face
that's redundant; but I believe we have things fixed so that we aren't
considering redundant plans wholesale. (Note the elimination of
match_unsorted_inner in joinpath.c.)

Once we get into GEQO territory, we are using the left-deep-only
heuristic because that's the only kind of plan GEQO can construct.
But at that point you've already given up any notion of exhaustive
search.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2005-02-22 06:40:40 Re: left-deep plans?
Previous Message Jim C. Nasby 2005-02-22 05:37:41 Re: Fwd: Apple Darwin disabled fsync?