Re: [PERFORM] Very inefficient query plan with disjunction in WHERE clause

2009-06-02 Thread Matthew Wakeling
On Mon, 1 Jun 2009, Koen Martens wrote: Anyway, any hints on getting this beast perform (without rewriting the query, that's not possible in this case due to the query being generated by an ORM) are welcome. I'm starting to think it is impossible, and that postgresql just doesn't work for this

Re: [PERFORM] Very inefficient query plan with disjunction in WHERE clause

2009-06-02 Thread Matthew Wakeling
On Mon, 1 Jun 2009, Koen Martens wrote: Anyway, any hints on getting this beast perform (without rewriting the query, that's not possible in this case due to the query being generated by an ORM) are welcome. I'm starting to think it is impossible, and that postgresql just doesn't work for this

Re: [PERFORM] Very inefficient query plan with disjunction in WHERE clause

2009-06-01 Thread Віталій Тимчишин
2009/6/1 Koen Martens > > Now, when I split up the OR in two distinct queries, everything is nice and > fast. Both queries run in sub-second time. Hi. PostgreSQL simply do not like ORs (can't use indexes in this case), so UNION/UNION ALL is your friend. Best regards, Vitalii Tymchyshyn

[PERFORM] Very inefficient query plan with disjunction in WHERE clause

2009-06-01 Thread Koen Martens
Hi all, I've been staring at this for hours (if not days). Any hints are appreciated! At first I thought "there must be a way to make postgresql perform on this thing", but i've lost hope that pgsql actually can deal with it.. The query is: SELECT DISTINCT posrel.pos, questions.number, q