Class: AwesomeExplain::SqlPlanNode
- Inherits:
-
Object
- Object
- AwesomeExplain::SqlPlanNode
- Defined in:
- app/models/awesome_explain/sql_plan_node.rb
Instance Attribute Summary collapse
-
#actual_loops ⇒ Object
Returns the value of attribute actual_loops.
-
#actual_rows ⇒ Object
Returns the value of attribute actual_rows.
-
#actual_startup_time ⇒ Object
Returns the value of attribute actual_startup_time.
-
#actual_total_time ⇒ Object
Returns the value of attribute actual_total_time.
-
#children ⇒ Object
Returns the value of attribute children.
-
#id ⇒ Object
Returns the value of attribute id.
-
#index_condition ⇒ Object
Returns the value of attribute index_condition.
-
#index_name ⇒ Object
Returns the value of attribute index_name.
-
#join_type ⇒ Object
Returns the value of attribute join_type.
-
#label ⇒ Object
Returns the value of attribute label.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#recheck_condition ⇒ Object
Returns the value of attribute recheck_condition.
-
#relation_name ⇒ Object
Returns the value of attribute relation_name.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#seq_scan ⇒ Object
(also: #seq_scan?)
Returns the value of attribute seq_scan.
-
#startup_cost ⇒ Object
Returns the value of attribute startup_cost.
-
#total_cost ⇒ Object
Returns the value of attribute total_cost.
-
#total_loops ⇒ Object
Returns the value of attribute total_loops.
-
#total_rows ⇒ Object
Returns the value of attribute total_rows.
-
#type ⇒ Object
Returns the value of attribute type.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ SqlPlanNode
constructor
A new instance of SqlPlanNode.
- #meta_data ⇒ Object
- #meta_data_str ⇒ Object
Constructor Details
#initialize ⇒ SqlPlanNode
Returns a new instance of SqlPlanNode.
26 27 28 29 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 26 def initialize @total_rows = 0 @total_loops = 0 end |
Instance Attribute Details
#actual_loops ⇒ Object
Returns the value of attribute actual_loops.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def actual_loops @actual_loops end |
#actual_rows ⇒ Object
Returns the value of attribute actual_rows.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def actual_rows @actual_rows end |
#actual_startup_time ⇒ Object
Returns the value of attribute actual_startup_time.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def actual_startup_time @actual_startup_time end |
#actual_total_time ⇒ Object
Returns the value of attribute actual_total_time.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def actual_total_time @actual_total_time end |
#children ⇒ Object
Returns the value of attribute children.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def children @children end |
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def id @id end |
#index_condition ⇒ Object
Returns the value of attribute index_condition.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def index_condition @index_condition end |
#index_name ⇒ Object
Returns the value of attribute index_name.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def index_name @index_name end |
#join_type ⇒ Object
Returns the value of attribute join_type.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def join_type @join_type end |
#label ⇒ Object
Returns the value of attribute label.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def label @label end |
#parent ⇒ Object
Returns the value of attribute parent.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def parent @parent end |
#recheck_condition ⇒ Object
Returns the value of attribute recheck_condition.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def recheck_condition @recheck_condition end |
#relation_name ⇒ Object
Returns the value of attribute relation_name.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def relation_name @relation_name end |
#rows ⇒ Object
Returns the value of attribute rows.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def rows @rows end |
#seq_scan ⇒ Object Also known as: seq_scan?
Returns the value of attribute seq_scan.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def seq_scan @seq_scan end |
#startup_cost ⇒ Object
Returns the value of attribute startup_cost.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def startup_cost @startup_cost end |
#total_cost ⇒ Object
Returns the value of attribute total_cost.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def total_cost @total_cost end |
#total_loops ⇒ Object
Returns the value of attribute total_loops.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def total_loops @total_loops end |
#total_rows ⇒ Object
Returns the value of attribute total_rows.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def total_rows @total_rows end |
#type ⇒ Object
Returns the value of attribute type.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def type @type end |
#width ⇒ Object
Returns the value of attribute width.
2 3 4 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 2 def width @width end |
Class Method Details
.build(data, parent = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 31 def self.build(data, parent = nil) instance = self.new instance.label = data.dig('Node Type') instance.type = data.dig('Node Type') instance.relation_name = data.dig('Relation Name') instance.startup_cost = data.dig('Startup Cost') instance.total_cost = data.dig('Total Cost') instance.rows = data.dig('Plan Rows') instance.width = data.dig('Plan Width') instance.actual_startup_time = data.dig('Actual Startup Time') instance.actual_total_time = data.dig('Actual Total Time') instance.actual_rows = data.dig('Actual Rows') instance.actual_loops = data.dig('Actual Loops') instance.recheck_condition = data.dig('Recheck Cond') instance.index_name = data.dig('Index Name') instance.index_condition = data.dig('Index Cond') instance.seq_scan = data.dig('Node Type') == 'Seq Scan' instance.parent = parent instance.children = [] instance end |
Instance Method Details
#meta_data ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 57 def data = [] data << "<strong>Join Type:</strong> #{join_type}" if join_type.present? data << "<strong>Rows:</strong> #{rows}" if rows.present? data << "<strong>Width:</strong> #{width}" if width.present? data << "<span #{seq_scan? ? 'class="bg-red-200 text-red-900 px-1 py-1 rounded-r"' : ''}><strong>Seq Scan:</strong> #{seq_scan?}</span>" data << "<strong>Index Name</strong> #{index_name}" if index_name.present? data << "<strong>Index Condition</strong> #{index_condition}" if index_condition.present? data << "<strong>Actual Rows</strong> #{actual_rows}" if actual_rows.present? data << "<strong>Actual Loops</strong> #{actual_loops}" if actual_loops.present? data << "<strong>Startup Cost</strong> #{startup_cost}" if startup_cost.present? data << "<strong>Total Cost</strong> #{total_cost}" if total_cost.present? data << "<strong>Actual Startup Time</strong> #{actual_startup_time}" if actual_startup_time.present? data << "<strong>Actual Total Time</strong> #{actual_total_time}" if actual_total_time.present? data end |
#meta_data_str ⇒ Object
53 54 55 |
# File 'app/models/awesome_explain/sql_plan_node.rb', line 53 def .join('<hr />') end |