Re: feature request: explain "with details" option - Mailing list pgsql-hackers

From Tom Lane
Subject Re: feature request: explain "with details" option
Date
Msg-id 20277.1473395742@sss.pgh.pa.us
Whole thread Raw
In response to Re: feature request: explain "with details" option  (Craig Ringer <craig@2ndquadrant.com>)
Responses Re: feature request: explain "with details" option  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Re: feature request: explain "with details" option  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Craig Ringer <craig@2ndquadrant.com> writes:
> On 9 September 2016 at 01:40, Roger Pack <rogerdpack2@gmail.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



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Logical Replication WIP
Next
From: Dilip Kumar
Date:
Subject: Re: [sqlsmith] Failed assertion in joinrels.c