Re: bug: json format and auto_explain - Mailing list pgsql-hackers

From Tom Lane
Subject Re: bug: json format and auto_explain
Date
Msg-id 27934.1260233292@sss.pgh.pa.us
Whole thread Raw
In response to Re: bug: json format and auto_explain  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> There's an awful lot of layers of function calls happening in
> explain.c for no really discernable purpose that I can see.
> ExplainOneQuery() calls either ExplainOneUtility() if it has a utility
> command or ExplainOneQuery_hook() if that's defined or else it plans
> the query and then calls ExplainOnePlan().  ExplainOneUtility() in
> turn calls ExplainExecuteQuery for execute statements and handles
> everything else internally.  The placement of the hook seems pretty
> dubious to me (does anyone actually use it?), and the whole structure
> seems like it could probably be flattened a bit.

IIRC, a fair amount of the messiness has to do with handling prepared
statements.  Maybe refactoring the division of labor between prepare.c
and explain.c would help.  Whether it's worth the trouble is
questionable though.  The immediate issue seems to be insufficient
thought about how to manage the initialization conditions for the
various formatters, and I don't think that any flattening or refactoring
of the rest of the logic would have made any difference there.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Need a mentor, and a project.
Next
From: Koichi Suzuki
Date:
Subject: Re: New PostgreSQL Committers