another dbase optimization

This commit is contained in:
Fabian Posch 2025-02-01 21:36:46 +01:00
parent dd377a4f0f
commit 5786b7bf22

View file

@ -140,11 +140,11 @@ bool Downloader::fetch_tasks(size_t n) {
"JOIN "
" actsim_passes ap ON ap.sim_configs = sc.artifact "
"LEFT JOIN "
" sim_outputs so ON sc.id = so.sim_config "
" sim_outputs so ON sc.has_reference = so.sim_config "
"JOIN "
" jobs j ON ap.job = j.id "
"WHERE "
" (so.id IS NULL OR so.part_status = 'not_started') "
" (so.part_status IS NULL OR so.part_status = 'finished') "
" AND ap.id IN ( "
" SELECT ap_dep.id "
" FROM actsim_passes ap_dep "
@ -156,14 +156,14 @@ bool Downloader::fetch_tasks(size_t n) {
" AND dep.pass_status != 'finished' "
" ) "
" ) "
" AND (sc.has_reference IS NULL OR "
" EXISTS ("
" SELECT 1 "
" FROM sim_outputs out "
" WHERE out.sim_config = sc.has_reference "
" AND out.part_status = 'finished' "
" ) "
" ) "
// " AND (sc.has_reference IS NULL OR "
// " EXISTS ("
// " SELECT 1 "
// " FROM sim_outputs out "
// " WHERE out.sim_config = sc.has_reference "
// " AND out.part_status = 'finished' "
// " ) "
// " ) "
// "ORDER BY "
// " ap.pass_status = 'in_progress' DESC, "
// " j.time_added ASC "