Difference between revisions of "Pg stat user tables"

From wikieduonline
Jump to navigation Jump to search
Line 1: Line 1:
<pre>
+
 
SELECT  
+
SELECT  
  relname,  
+
  relname,  
  100 * idx_scan / (seq_scan + idx_scan) percent_of_times_index_used,  
+
  100 * idx_scan / (seq_scan + idx_scan) percent_of_times_index_used,  
  n_live_tup rows_in_table
+
  n_live_tup rows_in_table
FROM  
+
FROM  
  pg_stat_user_tables
+
  [[pg_stat]]_user_tables
WHERE  
+
WHERE  
    seq_scan + idx_scan > 0  
+
    seq_scan + idx_scan > 0  
ORDER BY  
+
ORDER BY  
  n_live_tup DESC;
+
  n_live_tup DESC;
  
 
</pre>
 
</pre>

Revision as of 09:39, 5 August 2021

SELECT 
  relname, 
  100 * idx_scan / (seq_scan + idx_scan) percent_of_times_index_used, 
  n_live_tup rows_in_table
FROM 
  pg_stat_user_tables
WHERE 
    seq_scan + idx_scan > 0 
ORDER BY 
  n_live_tup DESC;

pg_statio_user_tables

See also

Advertising: