|From:||John Naylor <jcnaylor(at)gmail(dot)com>|
|To:||Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>|
|Subject:||Re: WIP: Avoid creation of the free space map for small tables|
|Views:||Raw Message | Whole Thread | Download mbox|
On 11/16/18, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
I've attached v8, which includes the 2-state map and addresses the points below:
> Some assorted comments:
> -Each heap and index relation, except for hash indexes, has a Free Space
> +Each heap relation, unless it is very small, and each index relation,
> +except for hash indexes, has a Free Space Map
> (FSM) to keep track of available space in the relation. It's stored
> It appears that line has ended abruptly.
> page = BufferGetPage(buffer);
> + targetBlock = BufferGetBlockNumber(buffer);
> if (!PageIsNew(page))
> elog(ERROR, "page %u of relation \"%s\" should be empty but is not",
> - BufferGetBlockNumber(buffer),
> + targetBlock,
> PageInit(page, BufferGetPageSize(buffer), 0);
> @@ -623,7 +641,18 @@ loop:
> * current backend to make more insertions or not, which is probably a
> * good bet most of the time. So for now, don't add it to FSM yet.
> - RelationSetTargetBlock(relation, BufferGetBlockNumber(buffer));
> + RelationSetTargetBlock(relation, targetBlock);
> Is this related to this patch? If not, I suggest let's do it
> separately if required.
> static int fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot,
> - uint8 newValue, uint8 minValue);
> + uint8 newValue, uint8 minValue);
> This appears to be a spurious change.
2 and 3 are separated into 0001.
> @@ -378,24 +386,15 @@ RelationGetBufferForTuple(Relation relation, Size
> * target.
> targetBlock = GetPageWithFreeSpace(relation, len + saveFreeSpace);
> + /*
> + * In case we used an in-memory map of available blocks, reset
> + * it for next use.
> + */
> + if (targetBlock < HEAP_FSM_CREATION_THRESHOLD)
> + ClearLocalMap();
> How will you clear the local map during error? I think you need to
> clear it in abort path and you can name the function as
> FSMClearLocalMap or something like that.
Done. I've put this call last before abort processing.
> +/*#define TRACE_TARGETBLOCK */
> Debugging leftover, do you want to retain this and related stuff
> during the development of patch?
I have kept it aside as a separate patch but not attached it for now.
Also, we don't quite have a consensus on the threshold value, but I
have set it to 4 pages for v8. If this is still considered too
expensive (and basic tests show it shouldn't be), I suspect it'd be
better to interleave the available block numbers as described a couple
days ago than lower the threshold further.
I have looked at zhio.c, and it seems trivial to adapt zheap to this patchset.
|Next Message||Thomas Munro||2018-11-23 07:39:13||Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)|
|Previous Message||Thomas Munro||2018-11-23 04:45:18||Re: Refactoring the checkpointer's fsync request queue|