e378d75 add build_copr_id index and build_chroot(status, started_on)

Authored and Committed by msuchy 5 years ago
    add build_copr_id index and build_chroot(status, started_on)
    
    This is because of query:
    SELECT COUNT(*) as result
                        FROM build_chroot JOIN build on build.id = build_chroot.build_id
                        WHERE
                            build.submitted_on < 1547458800
                            AND (
                                build_chroot.started_on > 1547458200
                                OR (build_chroot.started_on is NULL AND build_chroot.status = 4)
                                -- for currently pending builds we need to filter on status=pending because there might be
                                -- failed builds that have started_on=NULL
                            )
                            AND NOT build.canceled;
    
    before
     Planning time: 1.041 ms
     Execution time: 188.590 ms
    after
     Planning time: 0.987 ms
     Execution time: 0.864 ms