title: show last last_autovacuum/anaylze etc based on the 20 biggest tables
body: <p>I'm trying to monitor our postgresql DB and identify the 20 largest tables and than see when was the last vacuum and analyse took place.</p>
  
  <p>I have this query that shows me the largest 20 schema name/relname which is good and that's what I was looking for:</p>
  
  <pre><code>SELECT schema_name, relname, pg_size_pretty(table_size) AS size, table_size 
  FROM ( SELECT pg_catalog.pg_namespace.nspname  AS schema_name,relname, 
  pg_relation_size(pg_catalog.pg_class.oid) AS table_size FROM 
  pg_catalog.pg_class JOIN pg_catalog.pg_namespace ON relnamespace = 
  pg_catalog.pg_namespace.oid ) t WHERE schema_name NOT LIKE 'pg_%' ORDER BY 
  table_size DESC LIMIT 20;
  </code></pre>
  
  <p>I also have this query that shows me all the analysis I want to see with schema name and relname:</p>
  
  <pre><code>select relname, schemaname, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze from pg_stat_user_tables;
  </code></pre>
  
  <p>But I'm having a real hard time combining them together to one query that will show me when those analysis only for those 20 tables.</p>
  
  <p>Once this is done I'm looking to view the results in some sort of a graphic view in datadog, so If anyone have a good idea how to run this query as a datadog posgres query it will be amazing as well.</p>