Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
Debian Linux, Drill embedded 1.4, one machine.
Description
The plan for this kind of query takes an indefinite amount of time:
SELECT label, AVG(foo) FROM ( SELECT label, AVG(x) as foo FROM table1 GROUP BY label UNION ALL SELECT label, AVG(y) as foo FROM table2 GROUP BY label UNION ALL ... 30 times ) GROUP BY label
That is, the query is not executed at all, because the planning does not finish (we're talking about hours).
By disabling planner.enable_multiphase_agg, the planning completes immediately and the query runs.
But I guess this can happen also for other kind of queries.
I'd like to suggest a way to limit the planning time. Once this time elapses, the planner outputs the best plan found so far.