OSDN Git Service

Improve /contrib/pg_buffercache installation to use BEGIN/COMMIT,
authorBruce Momjian <bruce@momjian.us>
Wed, 26 Apr 2006 22:50:17 +0000 (22:50 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 26 Apr 2006 22:50:17 +0000 (22:50 +0000)
improve examples.

Mark Kirkwood

contrib/pg_buffercache/README.pg_buffercache
contrib/pg_buffercache/pg_buffercache.sql.in

index b5c9321..5fbfbe1 100644 (file)
@@ -76,8 +76,9 @@ Sample output
      isdirty boolean);
 
   regression=# SELECT c.relname, count(*) AS buffers
-               FROM pg_class c, pg_buffercache b
-               WHERE b.relfilenode = c.relfilenode
+               FROM pg_class c INNER JOIN pg_buffercache b
+               ON b.relfilenode = c.relfilenode INNER JOIN pg_database d
+               ON (b.reldatabase = d.oid AND d.datname = current_database())
                GROUP BY c.relname
                ORDER BY 2 DESC LIMIT 10;
                relname             | buffers
index 85c7b28..ea63234 100644 (file)
@@ -1,4 +1,5 @@
 -- Adjust this setting to control where the objects get created.
+BEGIN;
 SET search_path = public;
 
 -- Register the function.
@@ -16,3 +17,5 @@ CREATE VIEW pg_buffercache AS
 -- Don't want these to be available at public.
 REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC;
 REVOKE ALL ON pg_buffercache FROM PUBLIC;
+
+COMMIT;