Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
8 changed files
with
250 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* contrib/pg_buffercache/pg_buffercache--1.3--1.4.sql */ | ||
|
||
-- complain if script is sourced in psql, rather than via ALTER EXTENSION | ||
\echo Use "ALTER EXTENSION pg_buffercache UPDATE TO '1.4'" to load this file. \quit | ||
|
||
CREATE FUNCTION pg_buffercache_summary( | ||
OUT buffers_used int4, | ||
OUT buffers_unused int4, | ||
OUT buffers_dirty int4, | ||
OUT buffers_pinned int4, | ||
OUT usagecount_avg float8) | ||
AS 'MODULE_PATHNAME', 'pg_buffercache_summary' | ||
LANGUAGE C PARALLEL SAFE; | ||
|
||
-- Don't want these to be available to public. | ||
REVOKE ALL ON FUNCTION pg_buffercache_summary() FROM PUBLIC; | ||
GRANT EXECUTE ON FUNCTION pg_buffercache_summary() TO pg_monitor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# pg_buffercache extension | ||
comment = 'examine the shared buffer cache' | ||
default_version = '1.3' | ||
default_version = '1.4' | ||
module_pathname = '$libdir/pg_buffercache' | ||
relocatable = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters