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

Commit3e32109

Browse files
committed
Use key and partdesc from PartitionDispatch where possible.
Instead of repeatedly fishing the data out of the relcache entry,let's use the version that we cached in the PartitionDispatch. Wecould alternatively rip out the PartitionDispatch fields altogether,but it doesn't make much sense to have them and not use them; beforethis patch, partdesc was set but altogether unused. Amit Langote andI both thought using them was a litle better than removing them, sothis patch takes that approach.Discussion:http://postgr.es/m/CA+TgmobFnxcaW-Co-XO8=yhJ5pJXoNkCj6Z7jm9Mwj9FGv-D7w@mail.gmail.com
1 parent8ce29bb commit3e32109

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎src/backend/executor/execPartition.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void FormPartitionKeyDatum(PartitionDispatch pd,
4141
EState*estate,
4242
Datum*values,
4343
bool*isnull);
44-
staticintget_partition_for_tuple(Relationrelation,Datum*values,
44+
staticintget_partition_for_tuple(PartitionDispatchpd,Datum*values,
4545
bool*isnull);
4646
staticchar*ExecBuildSlotPartitionKeyDescription(Relationrel,
4747
Datum*values,
@@ -208,13 +208,11 @@ ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd,
208208
parent=pd[0];
209209
while (true)
210210
{
211-
PartitionDescpartdesc;
212211
TupleTableSlot*myslot=parent->tupslot;
213212
TupleConversionMap*map=parent->tupmap;
214213
intcur_index=-1;
215214

216215
rel=parent->reldesc;
217-
partdesc=RelationGetPartitionDesc(rel);
218216

219217
/*
220218
* Convert the tuple to this parent's layout so that we can do certain
@@ -245,13 +243,13 @@ ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd,
245243
* Nothing for get_partition_for_tuple() to do if there are no
246244
* partitions to begin with.
247245
*/
248-
if (partdesc->nparts==0)
246+
if (parent->partdesc->nparts==0)
249247
{
250248
result=-1;
251249
break;
252250
}
253251

254-
cur_index=get_partition_for_tuple(rel,values,isnull);
252+
cur_index=get_partition_for_tuple(parent,values,isnull);
255253

256254
/*
257255
* cur_index < 0 means we failed to find a partition of this parent.
@@ -1079,12 +1077,12 @@ FormPartitionKeyDatum(PartitionDispatch pd,
10791077
* found or -1 if none found.
10801078
*/
10811079
staticint
1082-
get_partition_for_tuple(Relationrelation,Datum*values,bool*isnull)
1080+
get_partition_for_tuple(PartitionDispatchpd,Datum*values,bool*isnull)
10831081
{
10841082
intbound_offset;
10851083
intpart_index=-1;
1086-
PartitionKeykey=RelationGetPartitionKey(relation);
1087-
PartitionDescpartdesc=RelationGetPartitionDesc(relation);
1084+
PartitionKeykey=pd->key;
1085+
PartitionDescpartdesc=pd->partdesc;
10881086
PartitionBoundInfoboundinfo=partdesc->boundinfo;
10891087

10901088
/* Route as appropriate based on partitioning strategy. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp