Exception: SeqScanner::SeqScanDetectedError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/seq_scanner/errors/seq_scan_detected_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(query_plan) ⇒ SeqScanDetectedError

Returns a new instance of SeqScanDetectedError.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/seq_scanner/errors/seq_scan_detected_error.rb', line 6

def initialize(query_plan)
  msg = <<~ERROR
    #{white("Sequential scan detected in query plan for the #{yellow(query_plan.name)} query:")}
    
    #{white("Query:")}
    #{white(query_plan.sql)}

    #{white("Query plan:")}
    #{PlanFormatter.format(query_plan.query_plan)}

    #{white("Bindings")}
    #{query_plan.binds.map { |bind| white("#{bind[:name]}: #{bind[:value]}") }.join("\n")}
  ERROR
  super(msg)
end