• Yorick Peterse's avatar
    Use a UNION for User.find_by_any_email · 24c8f422
    Yorick Peterse authored
    This is significantly faster than using a sub-query, at least when run
    on the GitLab.com production database. The benchmarks are a lot slower
    now with these changes, most likely due to PostgreSQL choosing a
    different (and less efficient) plan based on the amount of data present
    in the test database.
    
    Thanks to @dlemstra for suggesting the use of a UNION.
    24c8f422
user.rb 23.4 KB