Re: Very inefficient query plan with disjunction in WHERE clause

From: Віталій Тимчишин <tivv00(at)gmail(dot)com>
To: Koen Martens <pgsql(at)metro(dot)cx>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Very inefficient query plan with disjunction in WHERE clause
Date: 2009-06-01 16:19:12
Message-ID: 331e40660906010919v479c690gc41594db8150931a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

2009/6/1 Koen Martens <pgsql(at)metro(dot)cx>

>
> 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Alan McKay 2009-06-01 16:27:23 Re: Best way to load test a postgresql server
Previous Message Tom Lane 2009-06-01 16:18:15 Re: Using index for bitwise operations?