Re: Full Text index is not using during OR operation for multiple table join

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: AI Rumman <rummandba(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Full Text index is not using during OR operation for multiple table join
Date: 2011-01-05 03:39:01
Message-ID: AANLkTi=xjf4J6YJx9oMHQ=7ZZnNRnvE_BVtD+XrojNVc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Nov 29, 2010 at 5:27 AM, AI Rumman <rummandba(at)gmail(dot)com> wrote:
> Full Text index is not using during OR operation for multiple table join:

Hmm. If you have a condition of the form

<some-expression-involving-table-A> OR <some-expression-involving-table-B>

....then the system is going to have to join those tables before
evaluating that condition. It can't scan A and throw away rows that
don't match the first part of the condition, because they might match
the second prong, and visca versa.

You can sometimes speed these queries up by rewriting them as a UNION
ALL query. Maybe it'd be nice to make the planner consider such plans
automatically, but that'd be tricky to make work, I think.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Melzaiady 2011-01-05 05:38:12 Re: BUG #5809: bigserial duplicate value
Previous Message Robert Haas 2011-01-05 03:28:16 Re: BUG #5798: Some weird error with pl/pgsql procedure