Re: Adding LIMIT changes PostgreSQL plan from good to a bad one

2019-11-25 Thread Michael Korbakov
On November 22, 2019 at 20:28:39, Michael Lewis (mle...@entrata.com) wrote: I try to avoid DISTINCT and use GROUP BY when feasible, as well as avoiding OR condition. If you combined anon1 and anon2 with UNION ALL, and did (inner) join instead of left, or even moved all of that to EXISTS, perhaps t

Re: Adding LIMIT changes PostgreSQL plan from good to a bad one

2019-11-22 Thread Michael Korbakov
On November 21, 2019 at 19:14:33, Pavel Stehule (pavel.steh...@gmail.com) wrote: čt 21. 11. 2019 v 17:19 odesílatel Michael Korbakov napsal: > Hi everybody. > > I stumbled upon a weird problem with the query planner. I have a query > on a typical EAV schema: > > SELECT

Adding LIMIT changes PostgreSQL plan from good to a bad one

2019-11-21 Thread Michael Korbakov
ay? And what can I do to make the planner pick up a better plan? We are running PostgreSQL 10.10. Sincerely, -- Michael Korbakov