Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd2ca9a5

Browse files
committed
Minor corrections for partition pruning
When the partition pruning code finds an OpExpr with an operator thatdoes not belong to the partition key's opfamily, the code checks to seeif the negator of the operator is the opfamily's BTEqualStrategyNumberoperator so that partition pruning can support that operator and invertthe matching partitions. Doing this only works for LIST partitionedtables.Here we fix a minor correctness issue where when we discover we're notpruning for a LIST partitioned table, we return PARTCLAUSE_NOMATCH.PARTCLAUSE_NOMATCH is only meant to be used when the clause may matchanother partitioned key column. For this case, the clause is not goingto be any more useful to another partitioned key as the partition strategyis not going to change from one key to the next.Noticed while working4c2369a. No backpatch because returningPARTCLAUSE_NOMATCH instead of PARTCLAUSE_UNSUPPORTED mostly just causeswasted effort checking subsequent partition keys against a clause thatwill never be used for pruning.In passing, correct a comment for get_matching_range_bounds() whichmentions that an 'opstrategy' of 0 is supported. It's not, so fix thecomment. This was pointed out by Alexander Lakhin.Discussion:https://postgr.es/m/CAApHDvqriy8mPOFJ_Bd66YGXJ4+XULpv-4YdB+ePdCQFztyisA@mail.gmail.comDiscussion:https://postgr.es/m/312fb507-9b5e-cf83-d8ed-cd0da72a902c@gmail.com
1 parent818fefd commitd2ca9a5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎src/backend/partitioning/partprune.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,9 +1936,11 @@ match_clause_to_partition_key(GeneratePruningStepsContext *context,
19361936
* whatsoever, but their negators (equality) are. We can use one of
19371937
* those if we find it, but only for list partitioning.
19381938
*
1939-
* Note: we report NOMATCH on failure, in case a later partkey has the
1940-
* same expression but different opfamily. That's unlikely, but not
1941-
* much more so than duplicate expressions with different collations.
1939+
* Note: we report NOMATCH on failure if the negator isn't the
1940+
* equality operator for the partkey's opfamily as other partkeys may
1941+
* have the same expression but different opfamily. That's unlikely,
1942+
* but not much more so than duplicate expressions with different
1943+
* collations.
19421944
*/
19431945
if (op_in_opfamily(opno,partopfamily))
19441946
{
@@ -1948,8 +1950,9 @@ match_clause_to_partition_key(GeneratePruningStepsContext *context,
19481950
}
19491951
else
19501952
{
1953+
/* not supported for anything apart from LIST partitioned tables */
19511954
if (part_scheme->strategy!=PARTITION_STRATEGY_LIST)
1952-
returnPARTCLAUSE_NOMATCH;
1955+
returnPARTCLAUSE_UNSUPPORTED;
19531956

19541957
/* See if the negator is equality */
19551958
negator=get_negator(opno);
@@ -2924,7 +2927,7 @@ get_matching_list_bounds(PartitionPruneContext *context,
29242927
* multiple pruning steps might exclude it, so we infer its inclusion
29252928
* elsewhere.
29262929
*
2927-
* 'opstrategy'if non-zeromust be a btree strategy number.
2930+
* 'opstrategy' must be a btree strategy number.
29282931
*
29292932
* 'values' contains Datums indexed by the partition key to use for pruning.
29302933
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp