Re: SV: bad plan using nested loops

2018-02-02 Thread Johan Fredriksson
tor 2018-02-01 klockan 20:34 + skrev Johan Fredriksson: > > Johan Fredriksson writes: > > > Bad plan: https://explain.depesz.com/s/avtZ > > > Good plan: https://explain.depesz.com/s/SJSt > > > Any suggestions on how to make the planner make better dec

SV: bad plan using nested loops

2018-02-01 Thread Johan Fredriksson
> Johan Fredriksson writes: > > Bad plan: https://explain.depesz.com/s/avtZ > > Good plan: https://explain.depesz.com/s/SJSt > > Any suggestions on how to make the planner make better decisions for > > this query? > > Core of the problem looks to be the mise

bad plan using nested loops

2018-02-01 Thread Johan Fredriksson
Hello! I brought this issue up about two years ago but without getting any real explanation or solution. The problem is that PostgreSQL does really bad plans using nested loops. With "enable_nestloop = 0" the same query is run about 20 times faster. The sugested solution I got back then was to up