aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeSort.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-06-27 16:53:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-06-27 16:53:02 +0000
commitcdd5178c69c4cc80baedba0c7829c63b9f78d0f5 (patch)
tree4b4c06a83e1845d867647207cb970680c9b93c6f /src/backend/executor/nodeSort.c
parente99507eaa1cc366bd55c1f05c99e15c0a17b3990 (diff)
downloadpostgresql-cdd5178c69c4cc80baedba0c7829c63b9f78d0f5.tar.gz
postgresql-cdd5178c69c4cc80baedba0c7829c63b9f78d0f5.zip
Extend the MinimalTuple concept to tuplesort.c, thereby reducing the
per-tuple space overhead for sorts in memory. I chose to replace the previous patch that tried to write out the bare minimum amount of data when sorting on disk; instead, just dump the MinimalTuples as-is. This wastes 3 to 10 bytes per tuple depending on architecture and null-bitmap length, but the simplification in the writetup/readtup routines seems worth it.
Diffstat (limited to 'src/backend/executor/nodeSort.c')
-rw-r--r--src/backend/executor/nodeSort.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/backend/executor/nodeSort.c b/src/backend/executor/nodeSort.c
index 137c4e13639..b586a37a642 100644
--- a/src/backend/executor/nodeSort.c
+++ b/src/backend/executor/nodeSort.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.56 2006/03/05 15:58:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.57 2006/06/27 16:53:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,9 +41,7 @@ ExecSort(SortState *node)
EState *estate;
ScanDirection dir;
Tuplesortstate *tuplesortstate;
- HeapTuple heapTuple;
TupleTableSlot *slot;
- bool should_free;
/*
* get state info from node
@@ -103,8 +101,7 @@ ExecSort(SortState *node)
if (TupIsNull(slot))
break;
- tuplesort_puttuple(tuplesortstate,
- (void *) ExecFetchSlotTuple(slot));
+ tuplesort_puttupleslot(tuplesortstate, slot);
}
/*
@@ -131,15 +128,11 @@ ExecSort(SortState *node)
* Get the first or next tuple from tuplesort. Returns NULL if no more
* tuples.
*/
- heapTuple = tuplesort_getheaptuple(tuplesortstate,
- ScanDirectionIsForward(dir),
- &should_free);
-
slot = node->ss.ps.ps_ResultTupleSlot;
- if (heapTuple)
- return ExecStoreTuple(heapTuple, slot, InvalidBuffer, should_free);
- else
- return ExecClearTuple(slot);
+ (void) tuplesort_gettupleslot(tuplesortstate,
+ ScanDirectionIsForward(dir),
+ slot);
+ return slot;
}
/* ----------------------------------------------------------------