Re: BUG #17885: slow planning constraint_exclusion
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: sk@zsrv.org, pgsql-bugs@lists.postgresql.org
Date: 2023-04-04T22:16:28Z
Lists: 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