| From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
|---|---|
| To: | "Madusudanan(dot)B(dot)N" <b(dot)n(dot)madusudanan(at)gmail(dot)com> |
| Cc: | "Sven R(dot) Kunze" <srkunze(at)mail(dot)de>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
| Subject: | Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause |
| Date: | 2016-09-22 16:20:38 |
| Message-ID: | CAMkU=1wRD1UQEvLmDUciyujnhVKx7q792wCuUjCATBRHv2Tq7w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
On Thu, Sep 22, 2016 at 6:37 AM, Madusudanan.B.N <b(dot)n(dot)madusudanan(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2016-09-22 16:25:15 | Re: query against single partition uses index, against master table does seq scan |
| Previous Message | Igor Neyman | 2016-09-22 14:39:44 | Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause |