Re: Inefficiency in SLRU stats collection

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: tomas.vondra@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
Date: 2020-05-13T14:42:43Z
Lists: pgsql-hackers
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> AFAICS it is right and the change suggested looks reasonable to me.
> One arguable point might be whether it is right that SlruData holds
> pgstats internal index from the standpoint of modularity.  (It is one
> of the reasons I didn't propose a patch for that..)

Yeah, this is a fair point.  On the other hand, the existing code has
pgstat.c digging into the SLRU control structure, which is as bad or
worse a modularity violation.  Perhaps we could ditch that by having
slru.c obtain and store the integer index which it then passes to
the pgstat.c counter routines, rather than passing a SlruCtl pointer.

I'll have to look at whether 28cac71bd exposed a data structure that
was formerly private, but if it did I'd be VERY strongly inclined
to revert that.

			regards, tom lane



Commits

  1. Improve management of SLRU statistics collection.