]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Don't constraint-exclude partitioned tables as much
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 13 Aug 2019 14:26:04 +0000 (10:26 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 13 Aug 2019 14:26:04 +0000 (10:26 -0400)
commit815ef2f568c754dcb539cca574f1982317d74db6
treea82cc8ae258b512c60e9400a996ca05b1759f601
parent416c75cf38fbf58f4589fb27b520b64092a7ceff
Don't constraint-exclude partitioned tables as much

We only need to invoke constraint exclusion on partitioned tables when
they are a partition, and they themselves contain a default partition;
it's not necessary otherwise, and it's expensive, so avoid it.  Also, we
were trying once for each clause separately, but we can do it for all
the clauses at once.

While at it, centralize setting of RelOptInfo->partition_qual instead of
computing it in slightly different ways in different places.

Per complaints from Simon Riggs about 4e85642d935e; reviewed by Yuzuko
Hosoya, Kyotaro Horiguchi.

Author: Amit Langote.  I (Álvaro) again mangled the patch somewhat.
Discussion: https://postgr.es/m/CANP8+j+tMCY=nEcQeqQam85=uopLBtX-2vHiLD2bbp7iQQUKpA@mail.gmail.com
src/backend/optimizer/util/plancat.c
src/backend/partitioning/partprune.c