Partitioning [SOLVED]: PostgreSQL: when we should set constraint_exclusion off?

Partitioning [SOLVED]: PostgreSQL: when we should set constraint_exclusion off?

Home Forums Partitioning Partitioning [SOLVED]: PostgreSQL: when we should set constraint_exclusion off?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36927

    Anonymous

    QuestionQuestion

    From the official document, it seems “off” will spend a lot of time to check the partitioned and non-partitioned table to execute the plan. In such case, why we have off mode?

    Thanks

    #36928

    Anonymous

    Accepted AnswerAnswer

    I think you are misreading the documentation.

    If you use partitioning, you should not disable constraint_exclusion, otherwise you won’t have any advantages from partitioning during query execution, because all partitions will always be scanned.

    On the other hand, if you don’t use partitioning, and you have no check constraints on tables whose condition appears in queries regularly, it will save some planning time to disable constraint_exclusion.

    If in doubt, stick with the default value (usually a good idea).

    Source: https://stackoverflow.com/questions/47972087/postgresql-when-we-should-set-constraint-exclusion-off
    Author: Laurenz Albe
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.