• Dylan Griffith's avatar
    Remove N+1 queries from indexing issues · ed693eec
    Dylan Griffith authored
    The `#as_indexed_json` method is used to convert individual documents to
    the JSON that is sent to Elasticsearch during indexing. We need to
    preload the data before it gets to this method. We implemented the
    `.preload_indexing_data` method in
    https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56808 so we just
    need to add this to the various classes now. This MR updates it for
    `Issue` only.
    
    We also slightly refactor the issue_instance_proxy since it's more
    efficient to just use the `user_id` from the `issue_assignees` join
    table than to join again to `users` and also since it wasn't possible to
    get the preload to work without loading all of `users.*` which would be
    wasteful for a wide table and large numbers of records.
    ed693eec
324745-preload-issues-for-elasticsearch-indexing.yml 118 Bytes