ExplainOneQuery_hook ignored for EXPLAIN EXECUTE
ExplainOneQuery_hook ignored for EXPLAIN EXECUTE
От:
Andres Freund <andres@anarazel.de>
Дата:
Hi, I don't quite know what the hook in $subject was originally designed for, but right now it has the problem that it's not invoked for EXPLAIN EXECUTE. That's because ExplainExecuteQuery directly calls ExplainOnePlan instead of ExplainOneQuery_hook. Unfortunately that's not entirely trivial to fix, because the hook accepts a Query, not a PlannedStmt. Does anybody have a good way to fix this? Greetings, Andres Freund
Re: ExplainOneQuery_hook ignored for EXPLAIN EXECUTE
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Andres Freund writes: > I don't quite know what the hook in $subject was originally designed > for, but right now it has the problem that it's not invoked for EXPLAIN > EXECUTE. That's because ExplainExecuteQuery directly calls > ExplainOnePlan instead of ExplainOneQuery_hook. > Unfortunately that's not entirely trivial to fix, because the hook > accepts a Query, not a PlannedStmt. AFAIR, the purpose of that hook was to let index advisor plugins have control of the planning step in an EXPLAIN, so that they could do things like injecting hypothetical indexes. There isn't any easy way to do something similar in EXPLAIN EXECUTE because the plan comes out of the plancache. Why do you care? It's a pretty specialized hook. regards, tom lane
Re: ExplainOneQuery_hook ignored for EXPLAIN EXECUTE
От:
Andres Freund <andres@anarazel.de>
Дата:
On 2016-11-13 17:20:05 -0500, Tom Lane wrote: > Andres Freund writes: > > I don't quite know what the hook in $subject was originally designed > > for, but right now it has the problem that it's not invoked for EXPLAIN > > EXECUTE. That's because ExplainExecuteQuery directly calls > > ExplainOnePlan instead of ExplainOneQuery_hook. > > > Unfortunately that's not entirely trivial to fix, because the hook > > accepts a Query, not a PlannedStmt. > > AFAIR, the purpose of that hook was to let index advisor plugins have > control of the planning step in an EXPLAIN, so that they could do things > like injecting hypothetical indexes. There isn't any easy way to do > something similar in EXPLAIN EXECUTE because the plan comes out of the > plancache. > Why do you care? It's a pretty specialized hook. Citus currently uses it to output additional information for distributed queries. I suspect we'll instead, for now, have to intercept EXPLAIN as a whole then :( (moving to custom plans unfortunately is still a bit off unfortunately). Andres
Re: ExplainOneQuery_hook ignored for EXPLAIN EXECUTE
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Andres Freund writes: > On 2016-11-13 17:20:05 -0500, Tom Lane wrote: >> Why do you care? It's a pretty specialized hook. > Citus currently uses it to output additional information for distributed > queries. I suspect we'll instead, for now, have to intercept EXPLAIN as > a whole then :( (moving to custom plans unfortunately is still a bit off > unfortunately). Seems like you might want a hook further down then, perhaps at ExplainPrintPlan. regards, tom lane
Re: ExplainOneQuery_hook ignored for EXPLAIN EXECUTE
От:
Greg Stark <stark@mit.edu>
Дата:
On 13 November 2016 at 22:31, Tom Lane wrote: > Andres Freund writes: >> On 2016-11-13 17:20:05 -0500, Tom Lane wrote: >>> Why do you care? It's a pretty specialized hook. > >> Citus currently uses it to output additional information for distributed >> queries. I suspect we'll instead, for now, have to intercept EXPLAIN as >> a whole then :( (moving to custom plans unfortunately is still a bit off >> unfortunately). > > Seems like you might want a hook further down then, perhaps at > ExplainPrintPlan. Fwiw I've found myself wishing for the same hook. I would like to add a feature for pg_stat_statements to make some easy way to look up the queryid for a given query. It seems like having it annotate EXPLAIN output would be ideal. -- greg