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

Commitdca48d1

Browse files
committed
Remove useless lookup of root partitioned rel in ExecInitModifyTable().
node->partitioned_rels is only set in UPDATE/DELETE cases, butExecInitModifyTable only uses its "rel" variable in INSERT cases,so the extra logic to find the root rel is just a waste of complexityand cycles.Etsuro Fujita, reviewed by Amit LangoteDiscussion:https://postgr.es/m/93cf9816-2f7d-0f67-8ed2-4a4e497a6ab8@lab.ntt.co.jp
1 parent9c7d06d commitdca48d1

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

‎src/backend/executor/nodeModifyTable.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#include"foreign/fdwapi.h"
4747
#include"miscadmin.h"
4848
#include"nodes/nodeFuncs.h"
49-
#include"parser/parsetree.h"
5049
#include"storage/bufmgr.h"
5150
#include"storage/lmgr.h"
5251
#include"utils/builtins.h"
@@ -1932,20 +1931,8 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
19321931

19331932
estate->es_result_relation_info=saved_resultRelInfo;
19341933

1935-
/* The root table RT index is at the head of the partitioned_rels list */
1936-
if (node->partitioned_rels)
1937-
{
1938-
Indexroot_rti;
1939-
Oidroot_oid;
1940-
1941-
root_rti=linitial_int(node->partitioned_rels);
1942-
root_oid=getrelid(root_rti,estate->es_range_table);
1943-
rel=heap_open(root_oid,NoLock);/* locked by InitPlan */
1944-
}
1945-
else
1946-
rel=mtstate->resultRelInfo->ri_RelationDesc;
1947-
19481934
/* Build state for INSERT tuple routing */
1935+
rel=mtstate->resultRelInfo->ri_RelationDesc;
19491936
if (operation==CMD_INSERT&&
19501937
rel->rd_rel->relkind==RELKIND_PARTITIONED_TABLE)
19511938
{
@@ -2118,10 +2105,6 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
21182105
mtstate->ps.ps_ExprContext=NULL;
21192106
}
21202107

2121-
/* Close the root partitioned rel if we opened it above. */
2122-
if (rel!=mtstate->resultRelInfo->ri_RelationDesc)
2123-
heap_close(rel,NoLock);
2124-
21252108
/*
21262109
* If needed, Initialize target list, projection and qual for ON CONFLICT
21272110
* DO UPDATE.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp