heap_blks_hit and heap_blks_read

From: "Fernando Papa" <fpapa(at)claxson(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: heap_blks_hit and heap_blks_read
Date: 2002-10-24 13:57:51
Message-ID: CB94A4924490EC4A81EDA55BA378B7BA3B69A3@exch2k01.buehuergo.corp.claxson.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2002-10-24 14:42:00 Re: Hot Backup
Previous Message Tom Lane 2002-10-24 13:42:46 Re: Simulating a SELECT..FOR UPDATE to LOCK and SELECT statement