Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9b2009c

Browse files
committed
doc: add namespace column to pg_buffercache example query
Without the namespace, the table name could be ambiguous. Reported-by: adunham@arbormetrix.com Discussion: https://postgr.es/m/158155175140.23798.2189464781144503491@wrigleys.postgresql.org Backpatch-through: 9.5
1 parent d97d554 commit 9b2009c

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

doc/src/sgml/pgbuffercache.sgml

+16-15
Original file line numberDiff line numberDiff line change
@@ -148,27 +148,28 @@
148148
<title>Sample Output</title>
149149

150150
<screen>
151-
regression=# SELECT c.relname, count(*) AS buffers
151+
regression=# SELECT n.nspname, c.relname, count(*) AS buffers
152152
FROM pg_buffercache b INNER JOIN pg_class c
153153
ON b.relfilenode = pg_relation_filenode(c.oid) AND
154154
b.reldatabase IN (0, (SELECT oid FROM pg_database
155155
WHERE datname = current_database()))
156-
GROUP BY c.relname
157-
ORDER BY 2 DESC
156+
JOIN pg_namespace n ON n.oid = c.relnamespace
157+
GROUP BY n.nspname, c.relname
158+
ORDER BY 3 DESC
158159
LIMIT 10;
159160

160-
relname | buffers
161-
---------------------------------+---------
162-
tenk2 | 345
163-
tenk1 | 141
164-
pg_proc | 46
165-
pg_class | 45
166-
pg_attribute | 43
167-
pg_class_relname_nsp_index | 30
168-
pg_proc_proname_args_nsp_index | 28
169-
pg_attribute_relid_attnam_index | 26
170-
pg_depend | 22
171-
pg_depend_reference_index | 20
161+
nspname | relname | buffers
162+
------------+------------------------+---------
163+
public | delete_test_table | 593
164+
public | delete_test_table_pkey | 494
165+
pg_catalog | pg_attribute | 472
166+
public | quad_poly_tbl | 353
167+
public | tenk2 | 349
168+
public | tenk1 | 349
169+
public | gin_test_idx | 306
170+
pg_catalog | pg_largeobject | 206
171+
public | gin_test_tbl | 188
172+
public | spgist_text_tbl | 182
172173
(10 rows)
173174
</screen>
174175
</sect2>

0 commit comments

Comments
 (0)