class CQL::Performance::NPlusOneDetector

Overview

N+1 detector without event system

Included Modules

Defined in:

performance/n_plus_one_detector.cr

Constant Summary

MAX_PATTERNS = 100

Constructors

Instance Method Summary

Instance methods inherited from module CQL::Performance::NPlusOneDetectorInterface

clear : Void clear, end_relation_loading : Void end_relation_loading, issues : Array(Issue) issues, patterns patterns, record_query(sql : String, normalized_sql : String | Nil = nil) : Void record_query, start_relation_loading(relation_name : String, parent_model : String) : Void start_relation_loading

Instance methods inherited from class CQL::Performance::BasePerformanceComponent

enabled=(enabled : Bool) enabled=, enabled? : Bool enabled?, healthy? : Bool healthy?, reset reset, stats : StatsTracker stats

Instance methods inherited from module CQL::Performance::TimingUtils

categorize_duration(duration : Time::Span, slow_threshold : Time::Span = 100.milliseconds, very_slow_threshold : Time::Span = 1.second) : Symbol categorize_duration, format_duration(duration : Time::Span) : String format_duration, measure_execution(&) measure_execution

Constructor Detail

def self.new(config : Config::Detection = Config::Detection.new) #

[View source]

Instance Method Detail

def clear : Void #

Clear all data


[View source]
def end_relation_loading : Void #

[View source]
def issues : Array(Issue) #

Get performance issues


[View source]
def patterns : Array(NPlusOnePattern) #

Get detected patterns


[View source]
def record_query(sql : String, normalized_sql : String | Nil = nil) : Void #

Direct method call for query recording


[View source]
def start_relation_loading(relation_name : String, parent_model : String) : Void #

Mark relation loading boundaries


[View source]