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

Commit032f9ae

Browse files
author
Etsuro Fujita
committed
Avoid redundant checks in partition_bounds_copy().
Previously, partition_bounds_copy() checked whether the strategy for thegiven partition bounds was hash or not, and then determined the number ofelements in the datums in the datums array for the partition bounds, oneach iteration of the loop for copying the datums array, but there is noneed to do that. Perform the checks only once before the loop iteration.Author: Etsuro FujitaReported-by: Amit Langote and Julien RouhaudDiscussion:https://postgr.es/m/CAPmGK14Rvxrm8DHWvCjdoks6nwZuHBPvMnWZ6rkEx2KhFeEoPQ@mail.gmail.com
1 parent9573384 commit032f9ae

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

‎src/backend/partitioning/partbounds.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,8 @@ partition_bounds_copy(PartitionBoundInfo src,
789789
intndatums;
790790
intpartnatts;
791791
intnum_indexes;
792+
boolhash_part;
793+
intnatts;
792794

793795
dest= (PartitionBoundInfo)palloc(sizeof(PartitionBoundInfoData));
794796

@@ -819,17 +821,17 @@ partition_bounds_copy(PartitionBoundInfo src,
819821
else
820822
dest->kind=NULL;
821823

824+
/*
825+
* For hash partitioning, datums array will have two elements - modulus and
826+
* remainder.
827+
*/
828+
hash_part= (key->strategy==PARTITION_STRATEGY_HASH);
829+
natts=hash_part ?2 :partnatts;
830+
822831
for (i=0;i<ndatums;i++)
823832
{
824833
intj;
825834

826-
/*
827-
* For a corresponding hash partition, datums array will have two
828-
* elements - modulus and remainder.
829-
*/
830-
boolhash_part= (key->strategy==PARTITION_STRATEGY_HASH);
831-
intnatts=hash_part ?2 :partnatts;
832-
833835
dest->datums[i]= (Datum*)palloc(sizeof(Datum)*natts);
834836

835837
for (j=0;j<natts;j++)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp