Commit 12a323b7 authored by Tom Lane's avatar Tom Lane

Change relblocknumber field of pg_buffercache view from numeric to int8

for efficiency's sake.  Mark Kirkwood.
parent 978129f2
...@@ -34,7 +34,7 @@ Notes ...@@ -34,7 +34,7 @@ Notes
Column | references | Description Column | references | Description
----------------+----------------------+------------------------------------ ----------------+----------------------+------------------------------------
bufferid | | Id, 1->shared_buffers. bufferid | | Id, 1..shared_buffers.
relfilenode | pg_class.relfilenode | Refilenode of the relation. relfilenode | pg_class.relfilenode | Refilenode of the relation.
reltablespace | pg_tablespace.oid | Tablespace oid of the relation. reltablespace | pg_tablespace.oid | Tablespace oid of the relation.
reldatabase | pg_database.oid | Database for the relation. reldatabase | pg_database.oid | Database for the relation.
...@@ -66,13 +66,13 @@ Sample output ...@@ -66,13 +66,13 @@ Sample output
relfilenode | oid | relfilenode | oid |
reltablespace | oid | reltablespace | oid |
reldatabase | oid | reldatabase | oid |
relblocknumber | numeric | relblocknumber | bigint |
isdirty | boolean | isdirty | boolean |
View definition: View definition:
SELECT p.bufferid, p.relfilenode, p.reltablespace, p.reldatabase, SELECT p.bufferid, p.relfilenode, p.reltablespace, p.reldatabase,
p.relblocknumber, p.isdirty p.relblocknumber, p.isdirty
FROM pg_buffercache_pages() p(bufferid integer, relfilenode oid, FROM pg_buffercache_pages() p(bufferid integer, relfilenode oid,
reltablespace oid, reldatabase oid, relblocknumber numeric(10,0), reltablespace oid, reldatabase oid, relblocknumber bigint,
isdirty boolean); isdirty boolean);
regression=# SELECT c.relname, count(*) AS buffers regression=# SELECT c.relname, count(*) AS buffers
......
...@@ -11,7 +11,7 @@ LANGUAGE 'C'; ...@@ -11,7 +11,7 @@ LANGUAGE 'C';
CREATE VIEW pg_buffercache AS CREATE VIEW pg_buffercache AS
SELECT P.* FROM pg_buffercache_pages() AS P SELECT P.* FROM pg_buffercache_pages() AS P
(bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid, (bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid,
relblocknumber numeric(10), isdirty bool); relblocknumber int8, isdirty bool);
-- Don't want these to be available at public. -- Don't want these to be available at public.
REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC; REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* pg_buffercache_pages.c * pg_buffercache_pages.c
* display some contents of the buffer cache * display some contents of the buffer cache
* *
* $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.3 2005/04/01 08:41:19 neilc Exp $ * $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.4 2005/05/31 00:07:47 tgl Exp $
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -92,8 +92,8 @@ pg_buffercache_pages(PG_FUNCTION_ARGS) ...@@ -92,8 +92,8 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
OIDOID, -1, 0); OIDOID, -1, 0);
TupleDescInitEntry(tupledesc, (AttrNumber) 4, "reldatabase", TupleDescInitEntry(tupledesc, (AttrNumber) 4, "reldatabase",
OIDOID, -1, 0); OIDOID, -1, 0);
TupleDescInitEntry(tupledesc, (AttrNumber) 5, "relblockbumber", TupleDescInitEntry(tupledesc, (AttrNumber) 5, "relblocknumber",
NUMERICOID, -1, 0); INT8OID, -1, 0);
TupleDescInitEntry(tupledesc, (AttrNumber) 6, "isdirty", TupleDescInitEntry(tupledesc, (AttrNumber) 6, "isdirty",
BOOLOID, -1, 0); BOOLOID, -1, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment