Class: Benedictus::Plan::Node
- Inherits:
-
Object
- Object
- Benedictus::Plan::Node
- Defined in:
- lib/benedictus/plan/node.rb
Constant Summary collapse
- RECOGNIZED_KEYS =
[ "Node Type", "Relation Name", "Alias", "Index Name", "Startup Cost", "Total Cost", "Plan Rows", "Plan Width", "Actual Startup Time", "Actual Total Time", "Actual Rows", "Actual Loops", "Filter", "Index Cond", "Join Filter", "Hash Cond", "Recheck Cond", "Sort Method", "Sort Key", "Sort Space Type", "Sort Space Used", "Join Type", "Strategy", "Parent Relationship", "Subplan Name" ].freeze
Instance Attribute Summary collapse
-
#actual_loops ⇒ Object
readonly
Returns the value of attribute actual_loops.
-
#actual_rows ⇒ Object
readonly
Returns the value of attribute actual_rows.
-
#actual_startup_time ⇒ Object
readonly
Returns the value of attribute actual_startup_time.
-
#actual_total_time ⇒ Object
readonly
Returns the value of attribute actual_total_time.
-
#alias_name ⇒ Object
readonly
Returns the value of attribute alias_name.
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#hash_cond ⇒ Object
readonly
Returns the value of attribute hash_cond.
-
#index_cond ⇒ Object
readonly
Returns the value of attribute index_cond.
-
#index_name ⇒ Object
readonly
Returns the value of attribute index_name.
-
#join_filter ⇒ Object
readonly
Returns the value of attribute join_filter.
-
#join_type ⇒ Object
readonly
Returns the value of attribute join_type.
-
#node_type ⇒ Object
readonly
Returns the value of attribute node_type.
-
#parent_relationship ⇒ Object
readonly
Returns the value of attribute parent_relationship.
-
#plan_rows ⇒ Object
readonly
Returns the value of attribute plan_rows.
-
#plan_width ⇒ Object
readonly
Returns the value of attribute plan_width.
-
#recheck_cond ⇒ Object
readonly
Returns the value of attribute recheck_cond.
-
#relation_name ⇒ Object
readonly
Returns the value of attribute relation_name.
-
#sort_key ⇒ Object
readonly
Returns the value of attribute sort_key.
-
#sort_method ⇒ Object
readonly
Returns the value of attribute sort_method.
-
#sort_space_type ⇒ Object
readonly
Returns the value of attribute sort_space_type.
-
#sort_space_used ⇒ Object
readonly
Returns the value of attribute sort_space_used.
-
#startup_cost ⇒ Object
readonly
Returns the value of attribute startup_cost.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
-
#subplan_name ⇒ Object
readonly
Returns the value of attribute subplan_name.
-
#total_cost ⇒ Object
readonly
Returns the value of attribute total_cost.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
- #analyzed? ⇒ Boolean
-
#initialize(raw, children: []) ⇒ Node
constructor
A new instance of Node.
- #leaf? ⇒ Boolean
- #target ⇒ Object
Constructor Details
#initialize(raw, children: []) ⇒ Node
Returns a new instance of Node.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/benedictus/plan/node.rb', line 18 def initialize(raw, children: []) @raw = raw @node_type = raw["Node Type"] @relation_name = raw["Relation Name"] @alias_name = raw["Alias"] @index_name = raw["Index Name"] @startup_cost = raw["Startup Cost"] @total_cost = raw["Total Cost"] @plan_rows = raw["Plan Rows"] @plan_width = raw["Plan Width"] @actual_startup_time = raw["Actual Startup Time"] @actual_total_time = raw["Actual Total Time"] @actual_rows = raw["Actual Rows"] @actual_loops = raw["Actual Loops"] @filter = raw["Filter"] @index_cond = raw["Index Cond"] @join_filter = raw["Join Filter"] @hash_cond = raw["Hash Cond"] @recheck_cond = raw["Recheck Cond"] @sort_method = raw["Sort Method"] @sort_key = raw["Sort Key"] @sort_space_type = raw["Sort Space Type"] @sort_space_used = raw["Sort Space Used"] @join_type = raw["Join Type"] @strategy = raw["Strategy"] @parent_relationship = raw["Parent Relationship"] @subplan_name = raw["Subplan Name"] @children = children @attrs = raw.reject { |k, _| RECOGNIZED_KEYS.include?(k) || k == "Plans" } @warnings = [] end |
Instance Attribute Details
#actual_loops ⇒ Object (readonly)
Returns the value of attribute actual_loops.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def actual_loops @actual_loops end |
#actual_rows ⇒ Object (readonly)
Returns the value of attribute actual_rows.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def actual_rows @actual_rows end |
#actual_startup_time ⇒ Object (readonly)
Returns the value of attribute actual_startup_time.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def actual_startup_time @actual_startup_time end |
#actual_total_time ⇒ Object (readonly)
Returns the value of attribute actual_total_time.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def actual_total_time @actual_total_time end |
#alias_name ⇒ Object (readonly)
Returns the value of attribute alias_name.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def alias_name @alias_name end |
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def attrs @attrs end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def children @children end |
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def filter @filter end |
#hash_cond ⇒ Object (readonly)
Returns the value of attribute hash_cond.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def hash_cond @hash_cond end |
#index_cond ⇒ Object (readonly)
Returns the value of attribute index_cond.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def index_cond @index_cond end |
#index_name ⇒ Object (readonly)
Returns the value of attribute index_name.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def index_name @index_name end |
#join_filter ⇒ Object (readonly)
Returns the value of attribute join_filter.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def join_filter @join_filter end |
#join_type ⇒ Object (readonly)
Returns the value of attribute join_type.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def join_type @join_type end |
#node_type ⇒ Object (readonly)
Returns the value of attribute node_type.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def node_type @node_type end |
#parent_relationship ⇒ Object (readonly)
Returns the value of attribute parent_relationship.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def parent_relationship @parent_relationship end |
#plan_rows ⇒ Object (readonly)
Returns the value of attribute plan_rows.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def plan_rows @plan_rows end |
#plan_width ⇒ Object (readonly)
Returns the value of attribute plan_width.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def plan_width @plan_width end |
#recheck_cond ⇒ Object (readonly)
Returns the value of attribute recheck_cond.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def recheck_cond @recheck_cond end |
#relation_name ⇒ Object (readonly)
Returns the value of attribute relation_name.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def relation_name @relation_name end |
#sort_key ⇒ Object (readonly)
Returns the value of attribute sort_key.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def sort_key @sort_key end |
#sort_method ⇒ Object (readonly)
Returns the value of attribute sort_method.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def sort_method @sort_method end |
#sort_space_type ⇒ Object (readonly)
Returns the value of attribute sort_space_type.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def sort_space_type @sort_space_type end |
#sort_space_used ⇒ Object (readonly)
Returns the value of attribute sort_space_used.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def sort_space_used @sort_space_used end |
#startup_cost ⇒ Object (readonly)
Returns the value of attribute startup_cost.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def startup_cost @startup_cost end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def strategy @strategy end |
#subplan_name ⇒ Object (readonly)
Returns the value of attribute subplan_name.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def subplan_name @subplan_name end |
#total_cost ⇒ Object (readonly)
Returns the value of attribute total_cost.
6 7 8 |
# File 'lib/benedictus/plan/node.rb', line 6 def total_cost @total_cost end |
#warnings ⇒ Object
Returns the value of attribute warnings.
16 17 18 |
# File 'lib/benedictus/plan/node.rb', line 16 def warnings @warnings end |
Instance Method Details
#analyzed? ⇒ Boolean
50 51 52 |
# File 'lib/benedictus/plan/node.rb', line 50 def analyzed? !actual_total_time.nil? end |
#leaf? ⇒ Boolean
54 55 56 |
# File 'lib/benedictus/plan/node.rb', line 54 def leaf? children.empty? end |
#target ⇒ Object
58 59 60 61 62 |
# File 'lib/benedictus/plan/node.rb', line 58 def target return alias_name if alias_name && relation_name && alias_name != relation_name relation_name end |