Database Size: <%= @database_size %>
<% if @system_stats_enabled %><%= pluralize(@unused_indexes.size, "unused index") %>. Remove them <% if @show_migrations %> with a migration <% end %> for faster writes. <% if @database.replicating? %> Check they aren’t used on replicas. <% end %>
rails generate migration remove_unused_indexes
And paste
<% @unused_indexes.sort_by { |q| [-q[:size_bytes], q[:index]] }.each do |query| %> <%= pghero_remove_index(query) %><% end %>
Breakdown not available (system catalog locked)
<% else %><%= link_to (@only_tables ? "Table" : "Relation"), @header_options.merge(sort: "name") %> | <%= link_to "Size", @header_options %> | <% if @space_stats_enabled %><%= link_to "#{@days}d Growth", @header_options.merge(sort: "growth") %> | <% end %>
---|---|---|
"> <% name = query[:relation] || query[:table] %> <% if @space_stats_enabled %> <%= link_to name, relation_space_path(name, schema: query[:schema]), target: "_blank", class: "relation-link" %> <% else %> <%= name %> <% end %> <% if query[:schema] != "public" %> <%= query[:schema] %> <% end %> <% if @unused_index_names.include?(query[:relation]) %> UNUSED <% end %> | <%= query[:size] %> | <% if @space_stats_enabled %><% if @growth_bytes_by_relation[[query[:schema], query[:relation]]] %> <% if @growth_bytes_by_relation[[query[:schema], query[:relation]]] < 0 %>-<% end %><%= PgHero.pretty_size(@growth_bytes_by_relation[[query[:schema], query[:relation]]].abs) %> <% else %> Unknown <% end %> | <% end %>