mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
heapam: Pass number of required pages to RelationGetBufferForTuple()
A future commit will use this information to determine how aggressively to extend the relation by. In heap_multi_insert() we know accurately how many pages we need once we need to extend the relation, providing an accurate lower bound for how much to extend. Reviewed-by: Melanie Plageman <melanieplageman@gmail.com> Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de
This commit is contained in:
@@ -301,6 +301,11 @@ RelationAddExtraBlocks(Relation relation, BulkInsertState bistate)
|
||||
* Returns pinned and exclusive-locked buffer of a page in given relation
|
||||
* with free space >= given len.
|
||||
*
|
||||
* If num_pages is > 1, we will try to extend the relation by at least that
|
||||
* many pages when we decide to extend the relation. This is more efficient
|
||||
* for callers that know they will need multiple pages
|
||||
* (e.g. heap_multi_insert()).
|
||||
*
|
||||
* If otherBuffer is not InvalidBuffer, then it references a previously
|
||||
* pinned buffer of another page in the same relation; on return, this
|
||||
* buffer will also be exclusive-locked. (This case is used by heap_update;
|
||||
@@ -359,7 +364,8 @@ Buffer
|
||||
RelationGetBufferForTuple(Relation relation, Size len,
|
||||
Buffer otherBuffer, int options,
|
||||
BulkInsertState bistate,
|
||||
Buffer *vmbuffer, Buffer *vmbuffer_other)
|
||||
Buffer *vmbuffer, Buffer *vmbuffer_other,
|
||||
int num_pages)
|
||||
{
|
||||
bool use_fsm = !(options & HEAP_INSERT_SKIP_FSM);
|
||||
Buffer buffer = InvalidBuffer;
|
||||
|
||||
Reference in New Issue
Block a user