> On May 25, 2021, at 17:16, David Rowley <dgrowle...@gmail.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.