Re: add_path() for Path without InitPlan: cost comparison vs. Paths that require one

2019-07-25 Thread Dent John
Hi Tom, > On 25 Jul 2019, at 14:25, Tom Lane wrote: > > Please explain yourself. InitPlans will, as a rule, get stuck into the > same place in the plan tree regardless of which paths are chosen; that's > why we need not consider them in path cost comparisons. Ah that’s true. I didn’t realise t

Re: add_path() for Path without InitPlan: cost comparison vs. Paths that require one

2019-07-25 Thread Tom Lane
Dent John writes: > However, if I factor back in the cost of the InitPlan, things net out much > more in favour of a scan against the MV. Of course, the add_path() comparison > logic doesn’t include the InitPlan cost, so the point is moot. Please explain yourself. InitPlans will, as a rule, g

add_path() for Path without InitPlan: cost comparison vs. Paths that require one

2019-07-25 Thread Dent John
Hi folks, I’ve run into a planning conundrum with my query rewriting extension for MVs when attempting to rewrite a RECURSIVE CTE. RECURSIVE CTEs are expensive — and presumably tricky to optimise — and so a good use case for query rewrite against an MV; all the more so if Yugo’s Incremental Vi