mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
Add ExecStorePinnedBufferHeapTuple.
This allows to avoid an unnecessary pin/unpin cycle when storing a tuple in an already pinned buffer into a slot, when the pin isn't further needed at the call site. Only a single caller for now (to ensure coverage), but upcoming patches will increase use of the new function. Author: Andres Freund Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
This commit is contained in:
@@ -379,19 +379,12 @@ TidNext(TidScanState *node)
|
||||
{
|
||||
/*
|
||||
* Store the scanned tuple in the scan tuple slot of the scan
|
||||
* state. Eventually we will only do this and not return a tuple.
|
||||
* state, transferring the pin to the slot.
|
||||
*/
|
||||
ExecStoreBufferHeapTuple(tuple, /* tuple to store */
|
||||
slot, /* slot to store in */
|
||||
buffer); /* buffer associated with
|
||||
* tuple */
|
||||
|
||||
/*
|
||||
* At this point we have an extra pin on the buffer, because
|
||||
* ExecStoreHeapTuple incremented the pin count. Drop our local
|
||||
* pin.
|
||||
*/
|
||||
ReleaseBuffer(buffer);
|
||||
ExecStorePinnedBufferHeapTuple(tuple, /* tuple to store */
|
||||
slot, /* slot to store in */
|
||||
buffer); /* buffer associated with
|
||||
* tuple */
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
Reference in New Issue
Block a user