2011-02-14 09:06:41 +08:00
|
|
|
/* contrib/pg_buffercache/pg_buffercache--1.0.sql */
|
2005-03-12 23:36:24 +08:00
|
|
|
|
2011-10-13 03:45:03 +08: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 23:36:24 +08:00
|
|
|
-- Register the function.
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION pg_buffercache_pages()
|
2005-03-12 23:36:24 +08:00
|
|
|
RETURNS SETOF RECORD
|
|
|
|
AS 'MODULE_PATHNAME', 'pg_buffercache_pages'
|
2006-02-28 00:09:50 +08:00
|
|
|
LANGUAGE C;
|
2005-03-12 23:36:24 +08:00
|
|
|
|
|
|
|
-- Create a view for convenient access.
|
|
|
|
CREATE VIEW pg_buffercache AS
|
|
|
|
SELECT P.* FROM pg_buffercache_pages() AS P
|
2010-11-24 04:27:50 +08:00
|
|
|
(bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid,
|
2008-08-14 20:56:41 +08:00
|
|
|
relforknumber int2, relblocknumber int8, isdirty bool, usagecount int2);
|
2010-11-24 04:27:50 +08:00
|
|
|
|
2011-02-14 09:06:41 +08:00
|
|
|
-- Don't want these to be available to public.
|
2005-03-12 23:36:24 +08:00
|
|
|
REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC;
|
|
|
|
REVOKE ALL ON pg_buffercache FROM PUBLIC;
|