Difference between revisions of "Cache hit ratio"

From wikieduonline
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
[[PostgreSQL]]:
 
[[PostgreSQL]]:
  SELECT  
+
  [[SELECT]]
 
   sum(heap_blks_read) as heap_read,
 
   sum(heap_blks_read) as heap_read,
 
   sum(heap_blks_hit)  as heap_hit,
 
   sum(heap_blks_hit)  as heap_hit,
Line 10: Line 10:
 
   [[pg_statio_user_tables]];
 
   [[pg_statio_user_tables]];
  
 +
heap_read  |  heap_hit  |        ratio
 +
-------------+--------------+------------------------
 +
37201451186 | 256244644067 | 0.87322560501639635699
 +
(1 row)
 +
 +
heap_read | heap_hit | ratio
 +
-----------+----------+-------
 +
            |          |
 +
(1 row)
 +
 +
== Related terms ==
 +
* [[TablePlus]]
 +
* <code>[[pg_stat_user_tables]]</code>
 +
* [[Autovacuum]]
  
 
== See also ==
 
== See also ==
 +
* {{SQL}}
 
* {{DBs}}
 
* {{DBs}}
 +
* {{PostgreSQL}}
  
 
[[Category:Databases]]
 
[[Category:Databases]]

Latest revision as of 08:41, 10 August 2021


PostgreSQL:

SELECT 
  sum(heap_blks_read) as heap_read,
  sum(heap_blks_hit)  as heap_hit,
  sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) as ratio
FROM 
  pg_statio_user_tables;
heap_read  |   heap_hit   |         ratio
-------------+--------------+------------------------
37201451186 | 256244644067 | 0.87322560501639635699
(1 row)
heap_read | heap_hit | ratio
-----------+----------+-------
           |          |
(1 row)

Related terms[edit]

See also[edit]

Advertising: