pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: pg_buffercache: Add pg_buffercache_summary()
3+ messages / 2 participants
[nested] [flat]

* pgsql: pg_buffercache: Add pg_buffercache_summary()
@ 2022-10-13 17:04  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Andres Freund @ 2022-10-13 17:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_buffercache: Add pg_buffercache_summary()

Using pg_buffercache_summary() is significantly cheaper than querying
pg_buffercache and summarizing in SQL.

Author: Melih Mutlu <m.melihmutlu@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>
Reviewed-by: Zhang Mingli <zmlpostgres@gmail.com>
Discussion: https://postgr.es/m/CAGPVpCQAXYo54Q%3D8gqBsS%3Du0uk9qhnnq4%2B710BtUhUisX1XGEg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2589434ae0fbfe08e46b6a4ffba400140b636074

Modified Files
--------------
contrib/pg_buffercache/Makefile                    |   3 +-
contrib/pg_buffercache/expected/pg_buffercache.out |  33 ++++++
contrib/pg_buffercache/meson.build                 |   1 +
.../pg_buffercache/pg_buffercache--1.3--1.4.sql    |  17 +++
contrib/pg_buffercache/pg_buffercache.control      |   2 +-
contrib/pg_buffercache/pg_buffercache_pages.c      |  67 ++++++++++++
contrib/pg_buffercache/sql/pg_buffercache.sql      |  18 ++++
doc/src/sgml/pgbuffercache.sgml                    | 114 ++++++++++++++++++++-
8 files changed, 250 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: pg_buffercache: Add pg_buffercache_os_pages
@ 2025-11-24 05:29  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2025-11-24 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_buffercache: Add pg_buffercache_os_pages

ba2a3c2302f has added a way to check if a buffer is spread across
multiple pages with some NUMA information, via a new view
pg_buffercache_numa that depends on pg_buffercache_numa_pages(), a SQL
function.  These can only be queried when support for libnuma exists,
generating an error if not.

However, it can be useful to know how shared buffers and OS pages map
when NUMA is not supported or not available.  This commit expands the
capabilities around pg_buffercache_numa:
- pg_buffercache_numa_pages() is refactored as an internal function,
able to optionally process NUMA.  Its SQL definition prior to this
commit is still around to ensure backward-compatibility with v1.6.
- A SQL function called pg_buffercache_os_pages() is added, able to work
with or without NUMA.
- The view pg_buffercache_numa is redefined to use
pg_buffercache_os_pages().
- A new view is added, called pg_buffercache_os_pages.  This ignores
NUMA for its result processing, for a better efficiency.

The implementation is done so as there is no code duplication between
the NUMA and non-NUMA views/functions, relying on one internal function
that does the job for all of them.  The module is bumped to v1.7.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/Z/fFA2heH6lpSLlt@ip-10-97-1-34.eu-west-3.compute.internal

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4b203d499c610160e9867e6add2366780429344c

Modified Files
--------------
contrib/pg_buffercache/Makefile                    |   2 +-
contrib/pg_buffercache/expected/pg_buffercache.out |  18 ++
contrib/pg_buffercache/meson.build                 |   1 +
.../pg_buffercache/pg_buffercache--1.6--1.7.sql    |  33 ++++
contrib/pg_buffercache/pg_buffercache.control      |   2 +-
contrib/pg_buffercache/pg_buffercache_pages.c      | 198 +++++++++++++--------
contrib/pg_buffercache/sql/pg_buffercache.sql      |   8 +
doc/src/sgml/pgbuffercache.sgml                    | 108 ++++++++++-
src/tools/pgindent/typedefs.list                   |   4 +-
9 files changed, 289 insertions(+), 85 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: pg_buffercache: Add pg_buffercache_mark_dirty{,_relation,_all}()
@ 2025-11-28 00:04  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2025-11-28 00:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_buffercache: Add pg_buffercache_mark_dirty{,_relation,_all}()

This commit introduces three new functions for marking shared buffers as
dirty by using the functions introduced in 9660906dbd69:
* pg_buffercache_mark_dirty() for one shared buffer.
- pg_buffercache_mark_dirt_relation() for all the shared buffers in a
relation.
* pg_buffercache_mark_dirty_all() for all the shared buffers in pool.

The "_all" and "_relation" flavors are designed to address the
inefficiency of repeatedly calling pg_buffercache_mark_dirty() for each
individual buffer, which can be time-consuming when dealing with with
large shared buffers pool.

These functions are intended as developer tools and are available only
to superusers.  There is no need to bump the version of pg_buffercache,
4b203d499c61 having done this job in this release cycle.

Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Aidar Imamov <a.imamov@postgrespro.ru>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Joseph Koshakow <koshy44@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ0h_YoSqqutxV6DES1RW8ig6wcA8CR9rJk358YRMxZFmw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9ccc049dfe655ca9927f7c62559ec32f4d1f94dd

Modified Files
--------------
contrib/pg_buffercache/expected/pg_buffercache.out |  49 ++++++++-
.../pg_buffercache/pg_buffercache--1.6--1.7.sql    |  23 ++++
contrib/pg_buffercache/pg_buffercache_pages.c      | 122 +++++++++++++++++++++
contrib/pg_buffercache/sql/pg_buffercache.sql      |  17 ++-
doc/src/sgml/pgbuffercache.sgml                    |  93 +++++++++++++++-
5 files changed, 296 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-11-28 00:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 17:04 pgsql: pg_buffercache: Add pg_buffercache_summary() Andres Freund <andres@anarazel.de>
2025-11-24 05:29 pgsql: pg_buffercache: Add pg_buffercache_os_pages Michael Paquier <michael@paquier.xyz>
2025-11-28 00:04 pgsql: pg_buffercache: Add pg_buffercache_mark_dirty{,_relation,_all}() Michael Paquier <michael@paquier.xyz>

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