Re: feature request: explain "with details" option

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Roger Pack <rogerdpack2(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: feature request: explain "with details" option
Date: 2016-09-09 04:35:42
Message-ID: 20277.1473395742@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Craig Ringer <craig(at)2ndquadrant(dot)com> writes:
> On 9 September 2016 at 01:40, Roger Pack <rogerdpack2(at)gmail(dot)com> wrote:
>> Today's explain tells us what loops and scans were used, and relative
>> costs, etc. It doesn't seem to tell *why* the planner elected to use
>> what it did.

> One thing that's been discussed here is to have a way to see which
> potential plans are rejected and compare their costs.

> This isn't simple because there are often *lots* of variants. You
> don't just want to see the "top 10" candidate plans, because they're
> probably a bunch of small variants on the same plan; the ones you'll
> be interested in will probably be very different plans with very bad
> relative estimates.

The other big problem here is that the planner tries *very* hard to reject
losing paths early; so it does not even form an explainable plan for a
large fraction of the search space. (And if it did, you'd be dead before
you got your EXPLAIN result back.)

People have experimented with making the planner log every candidate path
before the path enters the comparison tournament (and, typically, doesn't
survive the first round). But I've never seen any version of that that
I thought would be intelligible to non-experts. It's exceedingly verbose
and it certainly doesn't look anything like what we know as EXPLAIN output.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2016-09-09 04:49:05 Re: [sqlsmith] Failed assertion in joinrels.c
Previous Message Peter Eisentraut 2016-09-09 04:33:53 Re: Logical Replication WIP