Class: AwesomeExplain::SqlPlanStats

Inherits:
Object
  • Object
show all
Defined in:
app/models/awesome_explain/sql_plan_stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSqlPlanStats

Returns a new instance of SqlPlanStats.



11
12
13
14
15
16
17
18
19
20
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 11

def initialize
  @table_stats = {}
  @node_type_stats = {}
  @index_stats = {}
  @total_rows_planned = 0
  @total_rows = 0
  @total_loops = 0
  @actual_total_time = 0
  @seq_scans = 0
end

Instance Attribute Details

#actual_total_timeObject

Returns the value of attribute actual_total_time.



2
3
4
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 2

def actual_total_time
  @actual_total_time
end

#index_statsObject

Returns the value of attribute index_stats.



2
3
4
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 2

def index_stats
  @index_stats
end

#node_type_statsObject

Returns the value of attribute node_type_stats.



2
3
4
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 2

def node_type_stats
  @node_type_stats
end

#seq_scansObject

Returns the value of attribute seq_scans.



2
3
4
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 2

def seq_scans
  @seq_scans
end

#table_statsObject

Returns the value of attribute table_stats.



2
3
4
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 2

def table_stats
  @table_stats
end

#total_loopsObject

Returns the value of attribute total_loops.



2
3
4
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 2

def total_loops
  @total_loops
end

#total_rowsObject

Returns the value of attribute total_rows.



2
3
4
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 2

def total_rows
  @total_rows
end

#total_rows_plannedObject

Returns the value of attribute total_rows_planned.



2
3
4
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 2

def total_rows_planned
  @total_rows_planned
end

Instance Method Details

#indexes?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 22

def indexes?
  !@index_stats.empty?
end

#to_hashObject Also known as: to_h



26
27
28
29
30
31
32
# File 'app/models/awesome_explain/sql_plan_stats.rb', line 26

def to_hash
  {
    table_stats: @table_stats,
    node_type_stats: @node_type_stats,
    index_stats: @index_stats,
  }
end