Difference between revisions of "Pg stat user tables"

From wikieduonline
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{{lowercase}}
 
  SELECT  
 
  SELECT  
 
   relname,  
 
   relname,  
Line 13: Line 13:
 
</pre>
 
</pre>
  
*[[Cache hit ratio]]: <code>[[pg_statio_user_tables]]</code>
+
 
 +
== [[PostgreSQL VACUUM]] ==
 +
SELECT
 +
  schemaname, relname,
 +
  last_vacuum, last_autovacuum,
 +
  vacuum_count, autovacuum_count
 +
FROM pg_stat_user_tables;
 +
 
 +
 
 +
== Related terms ==
 +
* <code>[[pg_statio_user_tables]]</code>
 +
* [[Cache hit ratio]]: <code>[[pg_statio_user_tables]]</code>
 +
* [[VACUUM FULL]]
  
 
== See also ==
 
== See also ==
 +
* {{pg_stat}}
 +
* {{VACUUM}}
 
* {{SQL}}
 
* {{SQL}}
 
* {{PostgreSQL}}
 
* {{PostgreSQL}}
 +
 +
 +
[[Category:PostgreSQL]]

Latest revision as of 13:37, 14 April 2022

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;


PostgreSQL VACUUM[edit]

SELECT
  schemaname, relname,
  last_vacuum, last_autovacuum,
  vacuum_count, autovacuum_count
FROM pg_stat_user_tables;


Related terms[edit]

See also[edit]

Advertising: