select round((blks_hit - blks_read) / blks_hit, 4) as buff_hit_ratio from (select sum(heap_blks_hit + idx_blks_hit + toast_blks_hit + tidx_blks_hit) as blks_hit, sum(heap_blks_read + idx_blks_read + toast_blks_read + tidx_blks_read) as blks_read from pg_statio_all_tables) as buff