Class: Benedictus::Heuristics::ExternalSort
- Defined in:
- lib/benedictus/heuristics/external_sort.rb
Instance Method Summary collapse
- #apply(node) ⇒ Object
-
#initialize ⇒ ExternalSort
constructor
A new instance of ExternalSort.
Methods inherited from Base
Constructor Details
#initialize ⇒ ExternalSort
Returns a new instance of ExternalSort.
6 7 8 |
# File 'lib/benedictus/heuristics/external_sort.rb', line 6 def initialize(**) super() end |
Instance Method Details
#apply(node) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/benedictus/heuristics/external_sort.rb', line 10 def apply(node) return [] unless node.node_type == "Sort" return [] unless node.sort_method.to_s.include?("external") space = if node.sort_space_used " (#{node.sort_space_used} kB on #{node.sort_space_type || "disk"})" else "" end [ warning( severity: :critical, code: :external_sort, message: "Sort spilled to disk via `#{node.sort_method}`#{space}.", suggestion: "Increase `work_mem` or add an index that already orders the data." ) ] end |