Re: BUG #17885: slow planning constraint_exclusion - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #17885: slow planning constraint_exclusion
Date
Msg-id CAApHDvphHUroVaGHnCtXF6S39_VkE2uL0X2F9HNyuQkfshhyzg@mail.gmail.com
Whole thread Raw
In response to BUG #17885: slow planning constraint_exclusion  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17885: slow planning constraint_exclusion
List pgsql-bugs
On Wed, 5 Apr 2023 at 05:14, PG Bug reporting form
<noreply@postgresql.org> wrote:
> Increasing the number of partitions or size of "not in" list further
> increases planning time. Reproduced on today's HEAD 16dev too. I found time
> is wasted somewhere in relation_excluded_by_constraints.

How did you come to the conclusion that the time is wasted?

> If I disable
> constraint_exclusion completely, then the planning time drops to a few
> milliseconds.

We still run relation_excluded_by_constraints() after partition
pruning only the remaining partitions.  I believe there were some
cases that we still didn't prune that relation_excluded_by_constraints
was able to eliminate. I don' recall the exact details of what those
cases are. I believe the call to relation_excluded_by_constraints()
was kept due to this.

You may want to just switch it off if it's too slow for you.  I don't
think anything you've shown here is worthy of being classed as a bug.

David



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17886: Error disabling user triggers on a partitioned table
Next
From: David Rowley
Date:
Subject: Re: BUG #17885: slow planning constraint_exclusion