diff --git a/lib/pghero/methods/maintenance.rb b/lib/pghero/methods/maintenance.rb
index <HASH>..<HASH> 100644
--- a/lib/pghero/methods/maintenance.rb
+++ b/lib/pghero/methods/maintenance.rb
@@ -61,17 +61,20 @@ module PgHero
         true
       end
 
-      def analyze_tables(verbose: false, min_size_gb: nil)
-        tables = table_stats.reject { |s| %w(information_schema pg_catalog).include?(s["schema"]) }
+      def analyze_tables(verbose: false, min_size_gb: nil, tables: nil)
+        tables = table_stats(table: tables).reject { |s| %w(information_schema pg_catalog).include?(s["schema"]) }
         tables = tables.select { |s| s["size"] > min_size_gb.gigabytes } if min_size_gb
         tables.map { |s| s.slice("schema", "table") }.each do |stats|
           begin
             with_timeout(lock_timeout: 5000, statement_timeout: 120000) do
               analyze "#{stats["schema"]}.#{stats["table"]}", verbose: verbose
             end
+            success = true
           rescue ActiveRecord::StatementInvalid => e
             $stderr.puts e.message
+            success = false
           end
+          stats["success"] = success
         end
       end
     end
Added tables option to analyze_tables