• Stan Hu's avatar
    Fix statement timeouts in RemoveRestrictedTodos migration · 5c8ce940
    Stan Hu authored
    On GitLab.com, the RemoveRestrictedTodos background migration
    encountered about 700+ failures a day due to statement timeouts.
    
    PostgreSQL might perform badly with a LIMIT 1 because the planner is
    guessing that scanning the index in ID order will come across the
    desired row in less time it will take the planner than using another
    index. The order_hint does not affect the search results. For example,
    `ORDER BY id ASC, updated_at ASC` means the same thing as `ORDER BY id
    ASC`.
    
    Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52649
    5c8ce940
each_batch.rb 3.13 KB