One thing that isn't helping is that you have a redundant predicate. The selectivity of this predicate is also estimated too low, so removing the redundant predicate might improve the estimate and change the plan: ( " + " o.consumer IS NULL " + " ) OR ( " + " o.consumer IS NOT NULL " + " AND o.consumer > 0 remove "o.consumer IS NOT NULL AND", which is implied by o.consumer > 0. This predicate should have been automatically removed, but the filter shown in depesz shows that it was not. If you can find out what the faster plan was, that would be helpful to know. ----- Jim Finnerty, AWS, Amazon Aurora PostgreSQL -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html