`ci_builds` table lacks of job-trace existence flag
ci_builds has the relation of job traces in
ci_job_artifacts table. It helps us when we query
ci_builds rows with/without job traces as we can maximize the advantage of PostgreSQL.
However, until %10.5,
ci_builds didn't have the relation of job traces in the database. This means, if we want to get rows with job traces, we need to check the file existence one by one. This is inefficient when we need to work on the whole rows, and therefore this issue is a blocker to its cleanup phase.
I think we need something preliminary work to mark each
ci_builds rows if it has a job trace or not. Probably we can extract the job IDs by
finding in the storage (file storage/object storage), this would be faster than checking the database rows one by one.