Closed adrianlzt closed 5 years ago
After reading more postgres docs, looks like the parameter that should be turned on is enable_partition_pruning
(by default is on).
constraint_exclusion
is for partition tables with inheritance
@adrianlzt thanks for bringing this up as I missed this point!
constraint_exclusion
allows the query planner to avoid including partitions in a query when it can prove they can't provide useful rows to satisfy it.
When I originally wrote the docs it was geared around PostgreSQL version 10 and the official docs suggested to have constraint_exclusion
enabled for declarative partitioning.
Since the release of PostgreSQL 11, the official version 11 docs do suggest to use the enable_partition_pruning
for declarative partitioning.
The good news is both are enabled by default; but it should be known to the user to make sure they are enabled.
I'll update the notes to address the difference.
@adrianlzt, I updated the notes to address your input. Please let me know if you have any more questions.
All good. Thanks!
I see that you recommend setting
constraint_exclusion = on
.From the postgres doc:
By default it takes value
partition
.So what's the point of turning on completely?
Thanks for the guide!