Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
15 lines (15 loc) · 659 Bytes

File metadata and controls

15 lines (15 loc) · 659 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- Show shared_buffers and os pagecache stat for current database
-- Require pg_buffercache and pgfincore
WITH qq AS (SELECT
c.oid,
count(b.bufferid) * 8192 AS size,
(select sum(pages_mem) * 4096 from pgfincore(c.oid::regclass)) as size_in_pagecache
FROM pg_buffercache b
INNER JOIN pg_class c ON b.relfilenode = pg_relation_filenode(c.oid)
AND b.reldatabase IN (0, (SELECT oid FROM pg_database WHERE datname = current_database()))
GROUP BY 1)
SELECT
pg_size_pretty(sum(qq.size)) AS shared_buffers_size,
pg_size_pretty(sum(qq.size_in_pagecache)) AS size_in_pagecache,
pg_size_pretty(pg_database_size(current_database())) as database_size
FROM qq;
Morty Proxy This is a proxified and sanitized view of the page, visit original site.