Re: bug: json format and auto_explain

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Euler Taveira de Oliveira <euler(at)timbira(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bug: json format and auto_explain
Date: 2009-12-08 00:48:12
Message-ID: 27934.1260233292@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Koichi Suzuki 2009-12-08 00:54:02 Re: [HACKERS] New PostgreSQL Committers
Previous Message Josh Berkus 2009-12-08 00:46:03 Re: Need a mentor, and a project.