<%= @query %>
<%= javascript_tag nonce: true do %> highlightQueries() <% end %> <% if @explain_enabled && @explainable_query %>

<%= button_to "Explain", explain_path, params: {query: @explainable_query}, form: {target: "_blank"}, class: "btn btn-info" %>

<% end %> <% if @origins && @origins.keys.select { |k| k.length > 0 }.any? %> <% @origins.sort_by { |o, c| [-c, o.to_s] }.each do |origin, count| %> <% end %>
Approx. Time
Origin
<% if origin.length > 0 %> <%= origin %> <% else %> Unknown <% end %> <% pct = (100.0 * count / @total_count).round %> <% if pct == 0 %> < 1% <% else %> <%= pct %>% <% end %>
<% end %> <% if @chart_data %>

Total Time ms

Loading...
<%= javascript_tag nonce: true do %> new Chartkick.LineChart("chart-1", <%= pghero_js_value(@chart_data) %>, {colors: ["#5bc0de"], legend: false, library: {plugins: {tooltip: {intersect: false, mode: "index"}}}}) <% end %>

Average Time ms

Loading...
<%= javascript_tag nonce: true do %> new Chartkick.LineChart("chart-2", <%= pghero_js_value(@chart2_data) %>, {colors: ["#5bc0de"], legend: false, library: {plugins: {tooltip: {intersect: false, mode: "index"}}}}) <% end %>

Calls

Loading...
<%= javascript_tag nonce: true do %> new Chartkick.LineChart("chart-3", <%= pghero_js_value(@chart3_data) %>, {colors: ["#5bc0de"], legend: false, library: {plugins: {tooltip: {intersect: false, mode: "index"}}}}) <% end %> <% else %>

Enable <%= link_to "historical query stats", "https://github.com/ankane/pghero", target: "_blank" %> to see more details

<% end %> <% if @tables.any? %>

Tables

<% @tables.each do |table| %> <% end %>
Name Rows Indexes
<%= table %> <%= number_with_delimiter(@row_counts[table]) if @row_counts[table] %> <% if @indexes_timeout %> Not available <% else %>
    <% @indexes_by_table[table].to_a.sort_by { |i| [i[:primary] ? 0 : 1, i[:columns]] }.each do |i3| %>
  • <%= i3[:columns].join(", ") %><% if i3[:using] != "btree" %> <%= i3[:using].to_s.upcase %><% end %> <% if i3[:primary] %> PRIMARY<% elsif i3[:unique] %> UNIQUE<% end %>
  • <% end %>
<% end %>
<% end %>