Class: Shiba::TableStats

Inherits:
Object
  • Object
show all
Defined in:
lib/shiba/table_stats.rb

Instance Method Summary collapse

Constructor Details

#initialize(dump_stats, connection, manual_stats) ⇒ TableStats

Returns a new instance of TableStats.



6
7
8
9
10
# File 'lib/shiba/table_stats.rb', line 6

def initialize(dump_stats, connection, manual_stats)
  @dump_stats = Shiba::IndexStats.new(dump_stats)
  @db_stats = Shiba::Fuzzer.new(connection).fuzz!
  @manual_stats = Shiba::IndexStats.new(manual_stats)
end

Instance Method Details

#estimate_key(table_name, key, parts) ⇒ Object



13
14
15
# File 'lib/shiba/table_stats.rb', line 13

def estimate_key(table_name, key, parts)
  ask_each(:estimate_key, table_name, key, parts)
end

#fuzzed?(table) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/shiba/table_stats.rb', line 25

def fuzzed?(table)
  !@dump_stats.tables[table] && !@manual_stats.tables[table] && @db_stats.tables[table]
end

#get_column_size(table_name, column) ⇒ Object



21
22
23
# File 'lib/shiba/table_stats.rb', line 21

def get_column_size(table_name, column)
  ask_each(:get_column_size, table_name, column)
end

#table_count(table) ⇒ Object



17
18
19
# File 'lib/shiba/table_stats.rb', line 17

def table_count(table)
  ask_each(:table_count, table)
end