2016-06-10 00:18:12 +03:00
|
|
|
/* contrib/pg_buffercache/pg_buffercache--1.2.sql */
|
2005-03-12 18:36:24 +03:00
|
|
|
|
2011-10-12 23:45:03 +04:00
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
|
|
\echo Use "CREATE EXTENSION pg_buffercache" to load this file. \quit
|
|
|
|
|
2005-03-12 18:36:24 +03:00
|
|
|
-- Register the function.
|
2011-02-14 05:24:14 +03:00
|
|
|
CREATE FUNCTION pg_buffercache_pages()
|
2005-03-12 18:36:24 +03:00
|
|
|
RETURNS SETOF RECORD
|
|
|
|
AS 'MODULE_PATHNAME', 'pg_buffercache_pages'
|
2016-06-10 00:18:12 +03:00
|
|
|
LANGUAGE C PARALLEL SAFE;
|
2005-03-12 18:36:24 +03:00
|
|
|
|
|
|
|
-- Create a view for convenient access.
|
|
|
|
CREATE VIEW pg_buffercache AS
|
|
|
|
SELECT P.* FROM pg_buffercache_pages() AS P
|
2010-11-23 23:27:50 +03:00
|
|
|
(bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid,
|
2014-08-22 02:28:37 +04:00
|
|
|
relforknumber int2, relblocknumber int8, isdirty bool, usagecount int2,
|
|
|
|
pinning_backends int4);
|
2010-11-23 23:27:50 +03:00
|
|
|
|
2011-02-14 04:06:41 +03:00
|
|
|
-- Don't want these to be available to public.
|
2005-03-12 18:36:24 +03:00
|
|
|
REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC;
|
|
|
|
REVOKE ALL ON pg_buffercache FROM PUBLIC;
|