Class: Mxrb::Oql::IndexAdvisor

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/oql/index_advisor.rb

Overview

Produces hypotheses only when cumulative workload supplies repeatable evidence.

Constant Summary collapse

TABLE_PATTERN =
/\b(?:FROM|JOIN)\s+["\[]?([\w$]+)["\]]?/i
PREDICATE_PATTERN =
/\b([A-Za-z_]\w*)\s*(?:=|<|>|<=|>=|LIKE|IN\s*\()/i

Instance Method Summary collapse

Instance Method Details

#analyze(report) ⇒ Object



13
14
15
16
17
# File 'lib/mxrb/oql/index_advisor.rb', line 13

def analyze(report)
  evidence = collect_evidence(report.queries)
  candidates = candidates_for(evidence, pressured_relations(report))
  IndexAdvice.new(candidates.freeze, redundant(report.index_stats).freeze)
end