Re: WIP: Avoid creation of the free space map for small tables
John Naylor <jcnaylor@gmail.com>
From: John Naylor <jcnaylor@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2018-10-14T16:29:28Z
Lists: pgsql-hackers
Attachments
- v4-0001-Avoid-creation-of-the-free-space-map-for-small-ta.patch (text/x-patch) patch v4-0001
- test-fsm-first-10-blocks.sql (application/sql)
- test-nofsm-first-block.sql (application/sql)
> On 10/13/18, Amit Kapila <amit.kapila16@gmail.com> wrote: >> I think you have found a good way to avoid creating FSM, but can't we >> use some simpler technique like if the FSM fork for a relation doesn't >> exist, then check the heapblk number for which we try to update the >> FSM and if it is lesser than HEAP_FSM_EXTENSION_THRESHOLD, then avoid >> creating the FSM. >> I think it would be better if we can find a common way to avoid >> creating FSM both during DO and REDO time. It might be possible if >> somethin like what I have said above is feasible. I've attached v4, which implements the REDO case, and as closely as possible to the DO case. I've created a new function to guard against creation of the FSM, which is called by RecordPageWithFreeSpace() and RecordAndGetPageWithFreeSpace(). Since XLogRecordPageWithFreeSpace() takes a relfilenode and not a relation, I had to reimplement that separately, but the logic is basically the same. It works under streaming replication. I've also attached a couple SQL scripts which, when the aforementioned DEBUG1 calls are enabled, show what the heap insert code is doing for different scenarios. Make check-world passes. -John Naylor
Commits
-
Improve code comments in b0eaa4c51b.
- 06c8a5090ed9 12.0 landed
-
During pg_upgrade, conditionally skip transfer of FSMs.
- 13e8643bfc29 12.0 landed
-
Add more tests for FSM.
- 6f918159a97a 12.0 landed
-
Doc: Update the documentation for FSM behavior for small tables.
- 29d108cdecbe 12.0 landed
-
Make FSM test portable.
- 08ecdfe7e5e0 12.0 landed
-
Avoid creation of the free space map for small heap relations, take 2.
- b0eaa4c51bbf 12.0 landed
-
Move page initialization from RelationAddExtraBlocks() to use, take 2.
- 0d1fe9f74e36 12.0 cited
-
Avoid creation of the free space map for small heap relations.
- ac88d2962a96 12.0 landed
-
In bootstrap mode, don't allow the creation of files if they don't already
- d66e3664b8ba 12.0 landed