pgsql: Count updates that move row to a new page.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Count updates that move row to a new page.
Date: 2023-03-23 18:17:24
Message-ID: E1pfPV5-0051VA-HP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Count updates that move row to a new page.

Add pgstat counter to track row updates that result in the successor
version going to a new heap page, leaving behind an original version
whose t_ctid points to the new version. The current count is shown by
the n_tup_newpage_upd column of each of the pg_stat_*_tables views.

The new n_tup_newpage_upd column complements the existing n_tup_hot_upd
and n_tup_upd columns. Tables that have high n_tup_newpage_upd values
(relative to n_tup_upd) are good candidates for tuning heap fillfactor.

Corey Huinker, with small tweaks by me.

Author: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Reviewed-By: Peter Geoghegan <pg(at)bowt(dot)ie>
Reviewed-By: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/CADkLM=ded21M9iZ36hHm-vj2rE2d=zcKpUQMds__Xm2pxLfHKA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ae4fdde1352fa6b2c9123e91435efafc78c370a0

Modified Files
--------------
doc/src/sgml/monitoring.sgml | 28 +++++++++++++++++++++++-----
src/backend/access/heap/heapam.c | 2 +-
src/backend/catalog/system_views.sql | 4 +++-
src/backend/utils/activity/pgstat_relation.c | 12 ++++++++++--
src/backend/utils/adt/pgstatfuncs.c | 18 ++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 10 ++++++++++
src/include/pgstat.h | 8 +++++---
src/test/regress/expected/rules.out | 12 +++++++++---
9 files changed, 80 insertions(+), 16 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-03-23 20:48:27 pgsql: doc: fix another case of missing productname markup
Previous Message Tom Lane 2023-03-23 17:25:41 Re: pgsql: Handle the "und" locale in ICU versions 54 and older.