Re: generic options for explain

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Greg Stark <greg(dot)stark(at)enterprisedb(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Magnus Hagander <magnus(at)hagander(dot)net>, Dave Page <dpage(at)pgadmin(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Dimitri Fontaine <dfontaine(at)hi-media(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: generic options for explain
Date: 2009-05-26 19:23:20
Message-ID: 603c8f070905261223u3cc610cfq38ca940e935805d3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 26, 2009 at 3:04 PM, Greg Stark <greg(dot)stark(at)enterprisedb(dot)com> wrote:
> (sorry for top posting - stupid apple)
>
> So the real elephant in the room is that the existing explain code is not
> really designed to be extensible, configurable, or to be printed in
> different formats.
>
> The current code is basically just gobs of text printed by different
> routines all over the code base. There are no data structures which

All over the code base? It looks to me like most of it is in
explain.c, specifically explain_outNode().

(On an unrelated point, it's difficult to imagine why someone thought
that was a good way of capitalizing & punctuating that function name.)

> represent what explain prints. The closest thing is the instrumentation
> objects which obtain the timing and counts but not the planner expectations
> or any associated data.
>
> If we're going to support multiple output formats or options to turn off and
> on sections I think we need to build a data structure independent of the
> format, have code to include or exclude stats as requested and then pass
> that to the requested formatter.

That sounds about right to me. I think that representation can be
pretty thin, though, maybe just a big struct with all the attributes
that are applicable to any node type and pointers to its left and
right children.

...Robert

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-05-26 19:25:41 Re: generic options for explain
Previous Message Tom Lane 2009-05-26 19:22:42 Re: [PATCH] cleanup hashindex for pg_migrator hashindex compat mode (for 8.4)