Sha256: 93f5757e81a910abdfe2ceec768971caec1dbfc1145963db1eb0d16ee1414229

Contents?: true

Size: 470 Bytes

Versions: 40

Compression:

Stored size: 470 Bytes

Contents

/* Calculates your cache hit rate for reading tables */

SELECT
  relname AS name,
  heap_blks_hit AS buffer_hits,
  heap_blks_read AS block_reads,
  heap_blks_hit + heap_blks_read AS total_read,
  CASE (heap_blks_hit + heap_blks_read)::float
    WHEN 0 THEN 'Insufficient data'
    ELSE (heap_blks_hit / (heap_blks_hit + heap_blks_read)::float)::text
  END ratio
FROM
  pg_statio_user_tables
ORDER BY
  heap_blks_hit / (heap_blks_hit + heap_blks_read + 1)::float DESC;

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ruby-pg-extras-4.4.4 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-4.4.3 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-4.4.2 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-4.4.1 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-4.4.0 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-4.2.0 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-4.1.0 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-4.0.1 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-4.0.0 lib/ruby_pg_extras/queries/table_cache_hit.sql
ruby-pg-extras-3.3.0 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.2.7 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.2.6 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.2.5 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.2.4 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.2.3 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.2.2 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.2.1 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.2.0 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.1.0 lib/ruby-pg-extras/queries/table_cache_hit.sql
ruby-pg-extras-3.0.6 lib/ruby-pg-extras/queries/table_cache_hit.sql