pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve management of SLRU statistics collection.
Date: Wed, 13 May 2020 17:08:42 +0000
Message-ID: <E1jYus6-0003ek-B1@gemulon.postgresql.org> (raw)

Improve management of SLRU statistics collection.

Instead of re-identifying which statistics bucket to use for a given
SLRU on every counter increment, do it once during shmem initialization.
This saves a fair number of cycles, and there's no real cost because
we could not have a bucket assignment that varies over time or across
backends anyway.

Also, get rid of the ill-considered decision to let pgstat.c pry
directly into SLRU's shared state; it's cleaner just to have slru.c
pass the stats bucket number.

In consequence of these changes, there's no longer any need to store
an SLRU's LWLock tranche info in shared memory, so get rid of that,
making this a net reduction in shmem consumption.  (That partly
reverts fe702a7b3.)

This is basically code review for 28cac71bd, so I also cleaned up
some comments, removed a dangling extern declaration, fixed some
things that should be static and/or const, etc.

Discussion: https://postgr.es/m/3618.1589313035@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/81ca8686305c4c62d723ab224ad5c414f350a3a0

Modified Files
--------------
src/backend/access/transam/slru.c   | 27 +++++------
src/backend/postmaster/pgstat.c     | 96 +++++++++++++++++++------------------
src/backend/utils/adt/pgstatfuncs.c |  2 +-
src/include/access/slru.h           | 10 ++--
src/include/pgstat.h                | 26 ++++------
5 files changed, 76 insertions(+), 85 deletions(-)



Message-ID: <E1jYus6-0003ek-B1@gemulon.postgresql.org>
Permalink:  ../E1jYus6-0003ek-B1@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jYus6-0003ek-B1@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Improve management of SLRU statistics collection.
  In-Reply-To: <E1jYus6-0003ek-B1@gemulon.postgresql.org>
  References: <E1jYus6-0003ek-B1@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox