Skip to content

Commit

Permalink
Add SQL for vm_cachestat
Browse files Browse the repository at this point in the history
into pgfincore 2.0.0
  • Loading branch information
c2main committed Dec 4, 2023
1 parent aee5296 commit 3551c1e
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
53 changes: 53 additions & 0 deletions pgfincore--1.3.1--2.0.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
CREATE FUNCTION
vm_cachestat(
IN relation regclass
, IN fork_name text
, IN block_num bigint
, IN nblocks bigint
, OUT vm_pagesize bigint
, OUT nr_cache bigint
, OUT nr_dirty bigint
, OUT nr_writeback bigint
, OUT nr_evicted bigint
, OUT nr_recently_evicted bigint
, OUT pg_pagesize bigint
)
RETURNS record
AS '$libdir/pgfincore'
LANGUAGE C;

CREATE FUNCTION
vm_cachestat(
IN relation regclass
, IN block_num bigint
, IN nblocks bigint
, OUT vm_pagesize bigint
, OUT nr_cache bigint
, OUT nr_dirty bigint
, OUT nr_writeback bigint
, OUT nr_evicted bigint
, OUT nr_recently_evicted bigint
, OUT pg_pagesize bigint
)
RETURNS record
AS $vm_cachestat$
SELECT * FROM vm_cachestat($1,'main',$2,$3)
$vm_cachestat$
LANGUAGE SQL;

CREATE FUNCTION
vm_cachestat(
IN relation regclass
, OUT vm_pagesize bigint
, OUT nr_cache bigint
, OUT nr_dirty bigint
, OUT nr_writeback bigint
, OUT nr_evicted bigint
, OUT nr_recently_evicted bigint
, OUT pg_pagesize bigint
)
RETURNS record
AS $vm_cachestat$
SELECT * FROM vm_cachestat($1,'main',NULL,NULL)
$vm_cachestat$
LANGUAGE SQL;
57 changes: 57 additions & 0 deletions pgfincore--2.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,60 @@ LANGUAGE C;

COMMENT ON FUNCTION pgfincore_drawer(varbit)
IS 'A naive drawing function to visualize page cache per object';

/*
* New functions
*/
CREATE FUNCTION
vm_cachestat(
IN relation regclass
, IN fork_name text
, IN block_num bigint
, IN nblocks bigint
, OUT vm_pagesize bigint
, OUT nr_cache bigint
, OUT nr_dirty bigint
, OUT nr_writeback bigint
, OUT nr_evicted bigint
, OUT nr_recently_evicted bigint
, OUT pg_pagesize bigint
)
RETURNS record
AS '$libdir/pgfincore'
LANGUAGE C;

CREATE FUNCTION
vm_cachestat(
IN relation regclass
, IN block_num bigint
, IN nblocks bigint
, OUT vm_pagesize bigint
, OUT nr_cache bigint
, OUT nr_dirty bigint
, OUT nr_writeback bigint
, OUT nr_evicted bigint
, OUT nr_recently_evicted bigint
, OUT pg_pagesize bigint
)
RETURNS record
AS $vm_cachestat$
SELECT * FROM vm_cachestat($1,'main',$2,$3)
$vm_cachestat$
LANGUAGE SQL;

CREATE FUNCTION
vm_cachestat(
IN relation regclass
, OUT vm_pagesize bigint
, OUT nr_cache bigint
, OUT nr_dirty bigint
, OUT nr_writeback bigint
, OUT nr_evicted bigint
, OUT nr_recently_evicted bigint
, OUT pg_pagesize bigint
)
RETURNS record
AS $vm_cachestat$
SELECT * FROM vm_cachestat($1,'main',NULL,NULL)
$vm_cachestat$
LANGUAGE SQL;

0 comments on commit 3551c1e

Please sign in to comment.