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