mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Create infrastructure for 'MinimalTuple' representation of in-memory
tuples with less header overhead than a regular HeapTuple, per my recent proposal. Teach TupleTableSlot code how to deal with these. As proof of concept, change tuplestore.c to store MinimalTuples instead of HeapTuples. Future patches will expand the concept to other places where it is useful.
This commit is contained in:
@ -934,19 +934,16 @@ get_crosstab_tuplestore(char *sql,
|
||||
*/
|
||||
if (lastrowid != NULL)
|
||||
{
|
||||
/*
|
||||
* switch to appropriate context while storing the tuple
|
||||
*/
|
||||
SPIcontext = MemoryContextSwitchTo(per_query_ctx);
|
||||
|
||||
/* rowid changed, flush the previous output row */
|
||||
tuple = BuildTupleFromCStrings(attinmeta, values);
|
||||
|
||||
/* switch to appropriate context while storing the tuple */
|
||||
SPIcontext = MemoryContextSwitchTo(per_query_ctx);
|
||||
tuplestore_puttuple(tupstore, tuple);
|
||||
MemoryContextSwitchTo(SPIcontext);
|
||||
|
||||
for (j = 0; j < result_ncols; j++)
|
||||
xpfree(values[j]);
|
||||
|
||||
/* now reset the context */
|
||||
MemoryContextSwitchTo(SPIcontext);
|
||||
}
|
||||
|
||||
values[0] = rowid;
|
||||
@ -970,16 +967,13 @@ get_crosstab_tuplestore(char *sql,
|
||||
lastrowid = pstrdup(rowid);
|
||||
}
|
||||
|
||||
/* switch to appropriate context while storing the tuple */
|
||||
SPIcontext = MemoryContextSwitchTo(per_query_ctx);
|
||||
|
||||
/* flush the last output row */
|
||||
tuple = BuildTupleFromCStrings(attinmeta, values);
|
||||
|
||||
/* switch to appropriate context while storing the tuple */
|
||||
SPIcontext = MemoryContextSwitchTo(per_query_ctx);
|
||||
tuplestore_puttuple(tupstore, tuple);
|
||||
|
||||
/* now reset the context */
|
||||
MemoryContextSwitchTo(SPIcontext);
|
||||
|
||||
}
|
||||
|
||||
if (SPI_finish() != SPI_OK_FINISH)
|
||||
|
Reference in New Issue
Block a user