| 1 |
/* contrib/pg_buffercache/pg_buffercache--1.2.sql */ |
| 2 |
|
| 3 |
-- complain if script is sourced in psql, rather than via CREATE EXTENSION |
| 4 |
\echo Use "CREATE EXTENSION pg_buffercache" to load this file. \quit |
| 5 |
|
| 6 |
-- Register the function. |
| 7 |
CREATE FUNCTION pg_buffercache_pages() |
| 8 |
RETURNS SETOF RECORD |
| 9 |
AS 'MODULE_PATHNAME', 'pg_buffercache_pages' |
| 10 |
LANGUAGE C PARALLEL SAFE; |
| 11 |
|
| 12 |
-- Create a view for convenient access. |
| 13 |
CREATE VIEW pg_buffercache AS |
| 14 |
SELECT P.* FROM pg_buffercache_pages() AS P |
| 15 |
(bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid, |
| 16 |
relforknumber int2, relblocknumber int8, isdirty bool, usagecount int2, |
| 17 |
pinning_backends int4); |
| 18 |
|
| 19 |
-- Don't want these to be available to public. |
| 20 |
REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC; |
| 21 |
REVOKE ALL ON pg_buffercache FROM PUBLIC; |