SELECT MIN(id) as id FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."file_type" IN (10, 101) GROUP BY "ci_job_artifacts"."job_id"

Original query:

GroupAggregate  (cost=12720579.44..12724683.42 rows=234373 width=8)
  Group Key: job_id
  ->  Sort  (cost=12720579.44..12721166.19 rows=234701 width=8)
        Sort Key: job_id
        ->  Index Scan using index_ci_job_artifacts_on_job_id_and_file_type on ci_job_artifacts  (cost=0.57..12699643.56 rows=234701 width=8)
              Index Cond: (file_type = ANY ('{10,101}'::integer[]))