mirror of
https://github.com/postgres/postgres.git
synced 2025-08-25 20:23:07 +03:00
Accept slightly-filled pages for tuples larger than fillfactor.
We always inserted a larger-than-fillfactor tuple into a newly-extended page, even when existing pages were empty or contained nothing but an unused line pointer. This was unnecessary relation extension. Start tolerating page usage up to 1/8 the maximum space that could be taken up by line pointers. This is somewhat arbitrary, but it should allow more cases to reuse pages. This has no effect on tables with fillfactor=100 (the default). John Naylor and Floris van Nee. Reviewed by Matthias van de Meent. Reported by Floris van Nee. Discussion: https://postgr.es/m/6e263217180649339720afe2176c50aa@opammb0562.comp.optiver.com
This commit is contained in:
@@ -676,7 +676,11 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
|
||||
|
||||
if (len + saveFreeSpace > pageFreeSpace)
|
||||
{
|
||||
/* Doesn't fit, so write out the existing page */
|
||||
/*
|
||||
* Doesn't fit, so write out the existing page. It always
|
||||
* contains a tuple. Hence, unlike RelationGetBufferForTuple(),
|
||||
* enforce saveFreeSpace unconditionally.
|
||||
*/
|
||||
|
||||
/* XLOG stuff */
|
||||
if (RelationNeedsWAL(state->rs_new_rel))
|
||||
|
Reference in New Issue
Block a user