Re: Getting query plan alternatives from query planner?

From: Stefan Keller <sfkeller(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Getting query plan alternatives from query planner?
Date: 2014-03-21 07:37:55
Message-ID: CAFcOn2_cv6tDwnc1w+aDz0hUiRY4Xh2ran4A14X9iApWWdU_XA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi Tom

You wrote:
> Path alternatives are rejected
> whenever possible before moving up to the next join level, so that what
> we have rejected is actually just a plan fragment in most cases.

Thanks for the quick answer. This sounds like a fair implementation decision.

Background for asking this is of course, that one want's 1. to
understand and 2. influence the optimizer in cases where one thinks
that the planner is wrong :-).

So, the bottom line is
1. that PostgreSQL doesn't offer no means to understand the planner
except EXPLAIN-ing the chosen plan?
2. and there's no road map to introduce planner hinting (like in
EnterpriseDB or Ora)?

Regards, Stefan

2014-03-20 18:08 GMT+01:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Stefan Keller <sfkeller(at)gmail(dot)com> writes:
>> I'd like to know from the query planner which query plan alternatives
>> have been generated and rejected. Is this possible?
>
> No, not really. People have occasionally hacked the planner to print
> rejected paths before they're discarded, but there's no convenient way
> to do anything except send the data to the postmaster log, which isn't
> all that convenient. A bigger problem is that people who are asking
> for this typically imagine that the planner generates complete plans
> before rejecting them; which it does not. Path alternatives are rejected
> whenever possible before moving up to the next join level, so that what
> we have rejected is actually just a plan fragment in most cases.
>
> regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Atri Sharma 2014-03-21 07:51:31 Re: Getting query plan alternatives from query planner?
Previous Message Ilya Kosmodemiansky 2014-03-21 06:02:40 Re: slow join not using index properly