Re: [PERFORM] Bad Execution Plan with "OR" Clauses Across Outer-Joined Tables

2013-04-30 Thread Mark Hampton
It's an interesting idea, however when I rewrote the original query to use "WHERE EXISTS" rather than "WHERE IN", I get the same bad execution plan. I think this really has to do with the Postgres optimizer's limitations with respect to outer joins. In my case it's certainly possible to rewrite t

Re: [PERFORM] Bad Execution Plan with "OR" Clauses Across Outer-Joined Tables

2013-04-30 Thread Vitalii Tymchyshyn
What I can say is that hibernate has "exists" in both HQL and criteria API (e.g. see http://www.cereslogic.com/pages/2008/09/22/hibernate-criteria-subqueries-exists/ for criteria). So, may be it's easier for you to tune your hibernate query to use exists 2013/4/30 Mark Hampton > I have a Hibern

[PERFORM] Bad Execution Plan with "OR" Clauses Across Outer-Joined Tables

2013-04-30 Thread Mark Hampton
I have a Hibernate-generated query (That's not going to change, so let's just focus on the Postgres side for now) like this: SELECT * from PERSON p where p.PERSON_ID in ( select distinct p2.PERSON_ID from PERSON p2 left oute