diff options
author | Andres Freund <andres@anarazel.de> | 2023-04-05 08:19:39 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2023-04-05 08:19:39 -0700 |
commit | 3d6a98457d8e21d85bed86cfd3e1d1df1b260721 (patch) | |
tree | e305eaf6f711f1b334a5e35224c022e90430dc05 /src/backend/access/heap/visibilitymap.c | |
parent | 86a3fc7ec8a03bca7120894bababa7c734628b4c (diff) |
Don't initialize page in {vm,fsm}_extend(), not needed
The read path needs to be able to initialize pages anyway, as relation
extensions are not durable. By avoiding initializing pages, we can, in a
future patch, extend the relation by multiple blocks at once.
Using smgrextend() for {vm,fsm}_extend() is not a good idea in general, as at
least one page of the VM/FSM will be read immediately after, always causing a
cache miss, requiring us to read content we just wrote.
Discussion: https://postgr.es/m/20230301223515.pucbj7nb54n4i4nv@awork3.anarazel.de
Diffstat (limited to 'src/backend/access/heap/visibilitymap.c')
-rw-r--r-- | src/backend/access/heap/visibilitymap.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c index 11e6d0d479f..114d1b42b3e 100644 --- a/src/backend/access/heap/visibilitymap.c +++ b/src/backend/access/heap/visibilitymap.c @@ -622,11 +622,9 @@ static void vm_extend(Relation rel, BlockNumber vm_nblocks) { BlockNumber vm_nblocks_now; - PGAlignedBlock pg; + PGAlignedBlock pg = {0}; SMgrRelation reln; - PageInit((Page) pg.data, BLCKSZ, 0); - /* * We use the relation extension lock to lock out other backends trying to * extend the visibility map at the same time. It also locks out extension @@ -662,8 +660,6 @@ vm_extend(Relation rel, BlockNumber vm_nblocks) /* Now extend the file */ while (vm_nblocks_now < vm_nblocks) { - PageSetChecksumInplace((Page) pg.data, vm_nblocks_now); - smgrextend(reln, VISIBILITYMAP_FORKNUM, vm_nblocks_now, pg.data, false); vm_nblocks_now++; } |