Re: BUG #17885: slow planning constraint_exclusion

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: sk(at)zsrv(dot)org, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17885: slow planning constraint_exclusion
Date: 2023-04-04 22:16:28
Message-ID: CAApHDvphHUroVaGHnCtXF6S39_VkE2uL0X2F9HNyuQkfshhyzg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 5 Apr 2023 at 05:14, PG Bug reporting form
<noreply(at)postgresql(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2023-04-04 22:53:58 Re: BUG #17885: slow planning constraint_exclusion
Previous Message Tom Lane 2023-04-04 18:24:32 Re: BUG #17886: Error disabling user triggers on a partitioned table