Skip to content

Filter build artifacts by partition_id

Max Orefice requested to merge morefice/filter-artifacts-partition-id into master

Ref: #430294 (closed)

What does this MR do and why?

Following up !146053 (merged).

This MR filters build artifacts by partition_id as it was identified not leveraging partition pruning.

Example of updated query

SELECT p_ci_builds.*
FROM p_ci_builds
WHERE p_ci_builds.type = 'Ci::Build'
  AND (EXISTS
         (SELECT 1
          FROM p_ci_job_artifacts
          WHERE p_ci_job_artifacts.job_id = p_ci_builds.id
+           AND p_ci_job_artifacts.partition_id = p_ci_builds.partition_id
            AND p_ci_job_artifacts.file_type = 1))

This will allow us to take advantage of partition pruning and select the right partition automatically without scanning all of them.

Merge request reports