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

Commitbaf8fc2

Browse files
committed
optimize find_deepest_partition() for single tables
1 parentf1a62b3 commitbaf8fc2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/planner_tree_modification.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,8 @@ modifytable_contains_fdw(List *rtable, ModifyTable *node)
885885

886886
/*
887887
* Find a single deepest subpartition using quals.
888-
* Return InvalidOid if it's not possible.
888+
* It's always better to narrow down the set of tables to be scanned.
889+
* Return InvalidOid if it's not possible (e.g. table is not partitioned).
889890
*/
890891
staticOid
891892
find_deepest_partition(Oidrelid,Indexrti,Expr*quals)
@@ -931,8 +932,13 @@ find_deepest_partition(Oid relid, Index rti, Expr *quals)
931932
Oid*children=PrelGetChildrenArray(prel),
932933
child=children[irange_lower(irange)];
933934

935+
/* Scan this partition */
936+
result=child;
937+
934938
/* Try to go deeper and see if there are subpartitions */
935-
result=find_deepest_partition(child,rti,quals);
939+
child=find_deepest_partition(child,rti,quals);
940+
if (OidIsValid(child))
941+
result=child;
936942
}
937943
break;
938944

@@ -943,8 +949,6 @@ find_deepest_partition(Oid relid, Index rti, Expr *quals)
943949
/* Don't forget to close 'prel'! */
944950
close_pathman_relation_info(prel);
945951
}
946-
/* Otherwise, return this table */
947-
elseresult=relid;
948952

949953
returnresult;
950954
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp