RE: non-HOT update not looking at FSM for large tuple update

From: Floris Van Nee <florisvannee(at)Optiver(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: non-HOT update not looking at FSM for large tuple update
Date: 2021-03-27 10:24:00
Message-ID: 84c1f5bf6f4e4e9497d30ae31b8dfdd9@opammb0562.comp.optiver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Noah,

Thanks for taking a look at this patch.

>
> In evaluating whether this is a good choice of value, I think about the
> expected page lifecycle. A tuple barely larger than fillfactor (roughly
> len=1+BLCKSZ*fillfactor/100) will start on a roughly-empty page. As long as
> the tuple exists, the server will skip that page for inserts. Updates can cause
> up to floor(99/fillfactor) same-size versions of the tuple to occupy the page
> simultaneously, creating that many line pointers. At the fillfactor=10
> minimum, it's good to accept otherwise-empty pages having at least nine line
> pointers, so a page can restart the aforementioned lifecycle. Tolerating even
> more line pointers helps when updates reduce tuple size or when the page
> was used for smaller tuples before it last emptied. At the BLCKSZ=8192
> default, this maxPaddedFsmRequest allows 36 line pointers (good or
> somewhat high). At the BLCKSZ=1024 minimum, it allows 4 line pointers
> (low). At the BLCKSZ=32768 maximum, 146 (likely excessive). I'm not
> concerned about optimizing non-default block sizes, so let's keep your
> proposal.
>

Agreed. You briefly mention this already, but the case that caused me to report this was exactly the one where under normal circumstances each UPDATE would be small. However, in rare cases, the tuple that is updated grows in size to 1k bytes (the specific case we encountered sometimes would under specific circumstances write extra info in a field, which would otherwise be NULL). Suppose that this 1k UPDATE does not fit into the current page (so no HOT update), then a new page would be created (HEAD behavior). However, it is very likely that the next updates to this same tuple will be the regular size again. This causes the higher number of line pointers on the page.

-Floris

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2021-03-27 10:41:07 Re: public schema default ACL
Previous Message Andy Fan 2021-03-27 09:47:18 Re: Keep notnullattrs in RelOptInfo (Was part of UniqueKey patch series)