• Stan Hu's avatar
    Optimize query for loading artifacts in pipeline · e386fabe
    Stan Hu authored
    Previously to query the latest artifacts for a given pipeline we would
    include the project ID in the query just in case. However, the inclusion
    of this project ID may cause the PostgreSQL query planner to use the
    wrong index. For example, it may use
    `index_ci_job_artifacts_on_project_id`, which is slow because there may
    be thousands of artifacts for a given project.
    
    To optimize this, we can just omit the project ID since we really care
    about job artifacts for a given build.
    
    Relates to
    https://gitlab.com/gitlab-com/gl-infra/production/-/issues/4674
    
    Changelog: performance
    e386fabe
sh-optimize-artifact-loading-mr.yml 107 Bytes