pgsql: Minor corrections for partition pruning

Поиск
Список
Период
Сортировка
От David Rowley
Тема pgsql: Minor corrections for partition pruning
Дата
Msg-id E1rcImP-0077JS-Pk@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Minor corrections for partition pruning

When the partition pruning code finds an OpExpr with an operator that
does not belong to the partition key's opfamily, the code checks to see
if the negator of the operator is the opfamily's BTEqualStrategyNumber
operator so that partition pruning can support that operator and invert
the matching partitions.  Doing this only works for LIST partitioned
tables.

Here we fix a minor correctness issue where when we discover we're not
pruning for a LIST partitioned table, we return PARTCLAUSE_NOMATCH.
PARTCLAUSE_NOMATCH is only meant to be used when the clause may match
another partitioned key column.  For this case, the clause is not going
to be any more useful to another partitioned key as the partition strategy
is not going to change from one key to the next.

Noticed while working 4c2369ac5.  No backpatch because returning
PARTCLAUSE_NOMATCH instead of PARTCLAUSE_UNSUPPORTED mostly just causes
wasted effort checking subsequent partition keys against a clause that
will never be used for pruning.

In passing, correct a comment for get_matching_range_bounds() which
mentions that an 'opstrategy' of 0 is supported.  It's not, so fix the
comment.  This was pointed out by Alexander Lakhin.

Discussion: https://postgr.es/m/CAApHDvqriy8mPOFJ_Bd66YGXJ4+XULpv-4YdB+ePdCQFztyisA@mail.gmail.com
Discussion: https://postgr.es/m/312fb507-9b5e-cf83-d8ed-cd0da72a902c@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d2ca9a50b5b99ef29aa65b68b5e6ddb253fbb04a

Modified Files
--------------
src/backend/partitioning/partprune.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: pgsql: Fix race leading to incorrect conflict cause in InvalidatePossib
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Revert "Improve compression and storage support with inheritance