Skip to content
Browse files

Support for postgres plans

  • Loading branch information...
1 parent 11c77b0 commit 79c0a9bb1ed6a36535676501291a8e4691eef069 @bkayser bkayser committed Sep 30, 2008
View
23 ui/controllers/newrelic_controller.rb
@@ -83,19 +83,16 @@ def explain_sql
explanations = @segment.explain_sql
if explanations
@explanation = explanations.first
-
- @row_headers = [
- nil,
- "Select Type",
- "Table",
- "Type",
- "Possible Keys",
- "Key",
- "Key Length",
- "Ref",
- "Rows",
- "Extra"
- ];
+ if !@explanation.blank?
+ first_row = @explanation.first
+ # Show the standard headers if it looks like a mysql explain plan
+ # Otherwise show blank headers
+ if first_row.length < NewRelic::MYSQL_EXPLAIN_COLUMNS.length
+ @row_headers = nil
+ else
+ @row_headers = NewRelic::MYSQL_EXPLAIN_COLUMNS
+ end
+ end
end
end
View
15 ui/views/newrelic/_explain_plans.rhtml
@@ -1,4 +1,5 @@
-<% @row_headers.length.times do |r| %>
+<% if @row_headers %>
+ <% @row_headers.length.times do |r| %>
<% if @row_headers[r] %>
<tr>
<th align=right nowrap>
@@ -11,4 +12,16 @@
<% end %>
</tr>
<% end %>
+ <% end %>
+<% else %>
+ <tr>
+ <th align=right>Plan</th>
+ <td><p class="plan">
+ <% @explanation.each do |row| -%>
+ <% row.each do |col| -%>
+<%= h(col) %>
+ <% end -%>
+ <% end -%>
+ </p></td>
+ </tr>
<% end %>
View
8 ui/views/newrelic/stylesheets/style.css
@@ -28,7 +28,7 @@ body{
width:76em;
}
#content{
- width: 984;
+ width: 984px;
margin: 10px auto;
text-align:left;
}
@@ -234,6 +234,12 @@ div.flash.notice
overflow: auto;
}
+.plan
+{
+ font-family: monospace;
+ font-size: 0.8em;
+ white-space: pre;
+}
#page_nav
{
height: 42px;

0 comments on commit 79c0a9b

Please sign in to comment.
Something went wrong with that request. Please try again.