Re: issue partition scan

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Cc: Nagaraj Raj <nagaraj(dot)sf(at)yahoo(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: issue partition scan
Date: 2021-05-26 00:27:27
Message-ID: 566EF81B-F9B2-4CD2-900E-5163732770FF@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> On May 25, 2021, at 17:16, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> It's because of the OR condition. If it was an AND condition then the
> planner wouldn't have to consider the fact that records in other
> partitions might be required for the join.

The OP might consider rewriting the query as a UNION, with each part of the top-lkevel OR being a branch of the UNION, but excluding the partitioned table from the JOINs for the branch of the UNION that doesn't appear to actually require them.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Eugen Konkov 2021-05-27 10:37:33 Count (select 1) subquery as constant
Previous Message David Rowley 2021-05-26 00:16:58 Re: issue partition scan