heap_blks_hit and heap_blks_read - Mailing list pgsql-general

From Fernando Papa
Subject heap_blks_hit and heap_blks_read
Date
Msg-id CB94A4924490EC4A81EDA55BA378B7BA3B69A3@exch2k01.buehuergo.corp.claxson.com
Whole thread Raw
List pgsql-general
Hi all!

I'm trying to set up several scripts to get information about how
database is used. Actually I try to get "cache ratio" or "buffer ratio"
(like Oracle "buffer cache hit ratio").
With "sum(heap_blks_hit) from pg_statio_user_tables" I get buffer reads,
and with "sum(heap_blks_read) from pg_statio_user_tables" I get disk
read... It's that true?
But I'mt thinking about this: when postgres read from disk and then put
data into buffer... both heap_blks_hit and heap_blks_read are increased?
or only heap_blks_read are increased?
Is this formula correct?: "select
sum(heap_blks_hit)*100/(sum(heap_blks_hit)+sum(heap_blks_read)) from
pg_statiouser_tables"

I'm not counting system tables for now, but I think could be easy to
change "user_tables" with "all_tables", and add pg_statio_all_indx too.

Thanks in advance.

--
Fernando O. Papa

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: 2 questions
Next
From: Robert Treat
Date:
Subject: Re: Hot Backup