fsm-last-page-only.patch

text/x-patch

Filename: fsm-last-page-only.patch
Type: text/x-patch
Part: 0
Message: Re: WIP: Avoid creation of the free space map for small tables

Patch

Format: unified
File+
src/backend/storage/freespace/freespace.c 2 8
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index 2ab1cb58b7..d6352aabd9 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -1103,15 +1103,9 @@ fsm_allow_writes(Relation rel, BlockNumber heapblk,
 static void
 fsm_local_set(Relation rel, BlockNumber curr_nblocks)
 {
-	BlockNumber blkno,
-				cached_target_block;
+	BlockNumber cached_target_block;
 
-	/*
-	 * Mark blocks available starting after the last block we have mapped,
-	 * and ending at the current last block in the relation.
-	 */
-	for (blkno = fsm_local_map.nblocks; blkno < curr_nblocks; blkno++)
-		fsm_local_map.map[blkno] = FSM_LOCAL_AVAIL;
+	fsm_local_map.map[curr_nblocks - 1] = FSM_LOCAL_AVAIL;
 
 	/* Cache the number of blocks. */
 	fsm_local_map.nblocks = curr_nblocks;