Re: [PERFORM] slow query plans caused by under-estimation of CTE cardinality

2013-02-19 Thread Tom Lane
John Lumby writes: > Meanwhile,   I have one other suggestion aimed specifically at problematic > CTEs: > Would it be reasonable to provide a new Planner Configuration option  : >   enable_nestloop_cte_inner (boolean) >   Enables or disables the query planner's use of nested-loop join plans in

Re: [PERFORM] slow query plans caused by under-estimation of CTE cardinality

2013-02-18 Thread John Lumby
Vitalii wrote > > Since cte is already an optimization fence, you can go further and make > it temporary table. > Create table;analyze;select should make optimizer's work much easier. > Thanks Vitalii  -  yes,   you are right,  and I have used that technique on other cases like this. How

Re: [PERFORM] slow query plans caused by under-estimation of CTE cardinality

2013-02-18 Thread Vitalii Tymchyshyn
Since cte is already an optimization fence, you can go further and make it temporary table. Create table;analyze;select should make optimizer's work much easier. 18 лют. 2013 18:45, "John Lumby" напис. > > On 2012-10-09 23:09:21 > Tom Lane wrote: > > > > > > re subject Why am I getting great/ter

[PERFORM] slow query plans caused by under-estimation of CTE cardinality

2013-02-18 Thread John Lumby
On 2012-10-09 23:09:21 Tom Lane wrote: > > re subject Why am I getting great/terrible estimates with these CTE queries? > You're assuming the case where the estimate is better is better for a > reason ... but it's only better as a result of blind dumb luck.  The > outer-level query planner do