Re: pg_reset_stats + cache I/O %

From: "mcelroy, tim" <tim(dot)mcelroy(at)bostonstock(dot)com>
To: 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'pgsql-performance(at)postgresql(dot)org'" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: pg_reset_stats + cache I/O %
Date: 2006-03-08 13:59:51
Message-ID: 0C4841B42F87D51195BD00B0D020F5CB044B241C@morpheus.bostonstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thanks Tom, sorry I neglected to copy the list on my previous email.....

Does this query make sense and is it valid for an accurate cache % hit ratio
for the entire DB? I would assume I could use the same logic with other
views such as pg_stat_user_tables to get a per table ratio?

SELECT 100 - round((blks_hit::numeric / (blks_hit::numeric +
blks_read::numeric)) * 100,2)
AS "Cache % Hit"
FROM pg_stat_database
WHERE datname = 'Fix1';

<RETURNS>

Cache % Hit
--------------------
98.06
(1 row)

Thank you,
Tim

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Tuesday, March 07, 2006 2:37 PM
To: mcelroy, tim
Cc: 'pgsql-performance(at)postgresql(dot)org'
Subject: Re: [PERFORM] pg_reset_stats + cache I/O %

"mcelroy, tim" <tim(dot)mcelroy(at)bostonstock(dot)com> writes:
> ERROR: function round(double precision, integer) does not exist

Try coercing to numeric instead of float. Also, it'd be a good idea to
put that coercion outside the sum()'s instead of inside --- summing
bigints is probably noticeably faster than summing numerics.

regards, tom lane

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ruben Rubio Rey 2006-03-08 14:28:36 Is good idea an array of 365 elements in a cell of a table, in order to perform searchs?
Previous Message Matthew Nuzum 2006-03-08 02:16:00 Re: Postgres on VPS - how much is enough?