Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause - Mailing list pgsql-performance

From Jeff Janes
Subject Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause
Date
Msg-id CAMkU=1wRD1UQEvLmDUciyujnhVKx7q792wCuUjCATBRHv2Tq7w@mail.gmail.com
Whole thread Raw
In response to Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause  ("Madusudanan.B.N" <b.n.madusudanan@gmail.com>)
List pgsql-performance
On Thu, Sep 22, 2016 at 6:37 AM, Madusudanan.B.N <b.n.madusudanan@gmail.com> wrote:
> However, this results in an awful slow plan (requiring to scan the complete big_table which obviously isn't optimal)

You mean to say there is a sequential scan ? An explain would be helpful. Are there indexes on the provided where clauses. 

Postgres can do a Bitmap heap scan to combine indexes, there is no need to fire two separate queries.

It can't combine bitmap scans that come from different tables.

But he can just combine the two queries into one, with a UNION.

Cheers,

Jeff

pgsql-performance by date:

Previous
From: Igor Neyman
Date:
Subject: Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause
Next
From: Tom Lane
Date:
Subject: Re: query against single partition uses index, against master table does seq scan