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

Commit5827078

Browse files
author
Artur Zakirov
committed
Use ItemPointer comparison in comparetup_rum() only in full-scan
1 parent48aae44 commit5827078

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

‎rumget.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2534,7 +2534,10 @@ rumgettuple(IndexScanDesc scan, ScanDirection direction)
25342534
so->tbm=NULL;
25352535
so->entriesIncrIndex=-1;
25362536
so->firstCall= false;
2537-
so->sortstate=rum_tuplesort_begin_rum(work_mem,so->norderbys, false);
2537+
so->sortstate=rum_tuplesort_begin_rum(work_mem,so->norderbys, false,
2538+
so->totalentries>0&&
2539+
so->entries[0]->queryCategory==RUM_CAT_EMPTY_QUERY&&
2540+
so->entries[0]->scanWithAddInfo);
25382541

25392542
scanPendingInsert(scan);
25402543

‎rumsort.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ struct Tuplesortstate
405405

406406
boolreverse;
407407

408+
/* Do we need ItemPointer comparison in comparetup_rum()? */
409+
boolcompareItemPointer;
410+
408411
/*
409412
* Resource snapshot for time of sort start.
410413
*/
@@ -1124,7 +1127,8 @@ rum_tuplesort_begin_index_hash(Relation heapRel,
11241127
}
11251128

11261129
Tuplesortstate*
1127-
rum_tuplesort_begin_rum(intworkMem,intnKeys,boolrandomAccess)
1130+
rum_tuplesort_begin_rum(intworkMem,intnKeys,boolrandomAccess,
1131+
boolcompareItemPointer)
11281132
{
11291133
Tuplesortstate*state=rum_tuplesort_begin_common(workMem,randomAccess);
11301134
MemoryContextoldcontext;
@@ -1152,6 +1156,7 @@ rum_tuplesort_begin_rum(int workMem, int nKeys, bool randomAccess)
11521156
state->readtup=readtup_rum;
11531157
state->reversedirection=reversedirection_rum;
11541158
state->reverse= false;
1159+
state->compareItemPointer=compareItemPointer;
11551160

11561161
MemoryContextSwitchTo(oldcontext);
11571162

@@ -3865,6 +3870,9 @@ comparetup_rum(const SortTuple *a, const SortTuple *b, Tuplesortstate *state)
38653870
return1;
38663871
}
38673872

3873+
if (!state->compareItemPointer)
3874+
return0;
3875+
38683876
/*
38693877
* If key values are equal, we sort on ItemPointer.
38703878
*/

‎rumsort.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ extern Tuplesortstate *rum_tuplesort_begin_datum(Oid datumType,
8989
boolnullsFirstFlag,
9090
intworkMem,boolrandomAccess);
9191
externTuplesortstate*rum_tuplesort_begin_rum(intworkMem,
92-
intnKeys,boolrandomAccess);
92+
intnKeys,boolrandomAccess,boolcompareItemPointer);
9393

9494
externvoidrum_tuplesort_set_bound(Tuplesortstate*state,int64bound);
9595

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp