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

Commitcdd5178

Browse files
committed
Extend the MinimalTuple concept to tuplesort.c, thereby reducing the
per-tuple space overhead for sorts in memory. I chose to replace theprevious patch that tried to write out the bare minimum amount of datawhen sorting on disk; instead, just dump the MinimalTuples as-is. Thiswastes 3 to 10 bytes per tuple depending on architecture and null-bitmaplength, but the simplification in the writetup/readtup routines seemsworth it.
1 parente99507e commitcdd5178

File tree

4 files changed

+139
-152
lines changed

4 files changed

+139
-152
lines changed

‎src/backend/access/nbtree/nbtsort.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
* Portions Copyright (c) 1994, Regents of the University of California
5757
*
5858
* IDENTIFICATION
59-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.101 2006/05/08 00:00:10 tgl Exp $
59+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.102 2006/06/27 16:53:02 tgl Exp $
6060
*
6161
*-------------------------------------------------------------------------
6262
*/
@@ -179,7 +179,7 @@ _bt_spooldestroy(BTSpool *btspool)
179179
void
180180
_bt_spool(IndexTupleitup,BTSpool*btspool)
181181
{
182-
tuplesort_puttuple(btspool->sortstate, (void*)itup);
182+
tuplesort_putindextuple(btspool->sortstate,itup);
183183
}
184184

185185
/*

‎src/backend/executor/nodeSort.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.56 2006/03/05 15:58:26 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.57 2006/06/27 16:53:02 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -41,9 +41,7 @@ ExecSort(SortState *node)
4141
EState*estate;
4242
ScanDirectiondir;
4343
Tuplesortstate*tuplesortstate;
44-
HeapTupleheapTuple;
4544
TupleTableSlot*slot;
46-
boolshould_free;
4745

4846
/*
4947
* get state info from node
@@ -103,8 +101,7 @@ ExecSort(SortState *node)
103101
if (TupIsNull(slot))
104102
break;
105103

106-
tuplesort_puttuple(tuplesortstate,
107-
(void*)ExecFetchSlotTuple(slot));
104+
tuplesort_puttupleslot(tuplesortstate,slot);
108105
}
109106

110107
/*
@@ -131,15 +128,11 @@ ExecSort(SortState *node)
131128
* Get the first or next tuple from tuplesort. Returns NULL if no more
132129
* tuples.
133130
*/
134-
heapTuple=tuplesort_getheaptuple(tuplesortstate,
135-
ScanDirectionIsForward(dir),
136-
&should_free);
137-
138131
slot=node->ss.ps.ps_ResultTupleSlot;
139-
if (heapTuple)
140-
returnExecStoreTuple(heapTuple,slot,InvalidBuffer,should_free);
141-
else
142-
returnExecClearTuple(slot);
132+
(void)tuplesort_gettupleslot(tuplesortstate,
133+
ScanDirectionIsForward(dir),
134+
slot);
135+
returnslot;
143136
}
144137

145138
/* ----------------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp