monitoring usage count distribution

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: schneider(at)ardentperf(dot)com
Subject: monitoring usage count distribution
Date: 2023-01-30 23:30:40
Message-ID: 20230130233040.GA2800702@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

My colleague Jeremy Schneider (CC'd) was recently looking into usage count
distributions for various workloads, and he mentioned that it would be nice
to have an easy way to do $SUBJECT. I've attached a patch that adds a
pg_buffercache_usage_counts() function. This function returns a row per
possible usage count with some basic information about the corresponding
buffers.

postgres=# SELECT * FROM pg_buffercache_usage_counts();
usage_count | buffers | dirty | pinned
-------------+---------+-------+--------
0 | 0 | 0 | 0
1 | 1436 | 671 | 0
2 | 102 | 88 | 0
3 | 23 | 21 | 0
4 | 9 | 7 | 0
5 | 164 | 106 | 0
(6 rows)

This new function provides essentially the same information as
pg_buffercache_summary(), but pg_buffercache_summary() only shows the
average usage count for the buffers in use. If there is interest in this
idea, another approach to consider could be to alter
pg_buffercache_summary() instead.

Thoughts?

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v1-0001-introduce-pg_buffercache_usage_counts.patch text/x-diff 9.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-01-31 00:00:47 Re: Making background psql nicer to use in tap tests
Previous Message Melanie Plageman 2023-01-30 23:18:45 Re: heapgettup refactoring