• Stan Hu's avatar
    Improve issue load time performance by avoiding ORDER BY in find_by call · aada0103
    Stan Hu authored
    The Sortable concern has a default scope that adds ORDER BY to all
    queries. EXPLAIN ANALYZE shows that this additional ORDER BY statement
    causes the SQL optimizer to use the wrong index, which leads to a load
    time of 2.9 s vs 0.073 ms just for the SELECT call. The minimal
    change here is to re-implement find_by using where and reorder to
    remove the ORDER BY clause in IssuesController#index.
    
    Closes #23075
    aada0103
issues_controller.rb 5.6 KB