mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user