• Reuben Pereira's avatar
    Remove duplicate members before joining with users table · 520b70a8
    Reuben Pereira authored
    If there are duplicate members when joining with the users
    table, it results in a lot of unnecessary memory usage.
    
    The members table can contain the same user_id multiple times
    if the user_id is part of multiple groups/projects. Currently, the
    SQL query generated by Group#billed_project_members joins the
    members and users tables. The duplicate user_ids in the members
    table can result in unnecessary memory usage.
    This commit modifies Group#billed_project_members to filter out
    duplicate members rows first in a subquery, and the subquery is then
    used as an IN condition to query the users table.
    
    It also renames Group#billed_project_members to
    Group#billed_project_users.
    520b70a8
member.rb 16.9 KB