Re: Bad Estimate for complex query with JOINS on subselects and OR in where conditions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Grman <peter(dot)grman(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Bad Estimate for complex query with JOINS on subselects and OR in where conditions
Date: 2019-08-16 14:25:40
Message-ID: 11504.1565965540@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Grman <peter(dot)grman(at)gmail(dot)com> writes:
> yes, I think this query is right below the geqo_threshold. But as I said,
> when I change only the WHERE condition to use AND instead of OR it's
> resulting in a really fast and efficient query (same planning time, but
> ~1/500th-1/1000th execution time). So there should be something different,
> or?

Don't really see why that would surprise you. Using AND means that the
individual conditions can be applied as filters, if the planner knows
how to use any one of them as (say) an indexscan or join qual. When
you use OR, that isn't possible.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2019-08-16 14:27:42 Re: Variable constants ?
Previous Message rob stone 2019-08-16 14:24:31 Re: A 3 table join question