Rewrite query to not use LEFT JOIN
Since we now consider only builds with main binaries successfull we can rewrite get_latest_successful_with_binary to not use a LEFT JOIN.
This commit is contained in:
parent
6c4f36bfba
commit
e262ae9d90
1 changed files with 4 additions and 5 deletions
|
@ -311,16 +311,15 @@ module Build = struct
|
||||||
|}
|
|}
|
||||||
|
|
||||||
let get_latest_successful_with_binary =
|
let get_latest_successful_with_binary =
|
||||||
Caqti_type.(tup2 (id `job) string) ->? Caqti_type.tup3 (id `build) t file_opt @@
|
Caqti_type.(tup2 (id `job) string) ->? Caqti_type.tup3 (id `build) t file @@
|
||||||
{| SELECT b.id,
|
{| SELECT b.id,
|
||||||
b.uuid, b.start_d, b.start_ps, b.finish_d, b.finish_ps,
|
b.uuid, b.start_d, b.start_ps, b.finish_d, b.finish_ps,
|
||||||
b.result_code, b.result_msg, b.console, b.script,
|
b.result_code, b.result_msg, b.console, b.script,
|
||||||
b.platform, b.main_binary, b.input_id, b.user, b.job,
|
b.platform, b.main_binary, b.input_id, b.user, b.job,
|
||||||
a.filepath, a.localpath, a.sha256, a.size
|
a.filepath, a.localpath, a.sha256, a.size
|
||||||
FROM build b
|
FROM build b, build_artifact a
|
||||||
LEFT JOIN build_artifact a ON
|
WHERE b.main_binary = a.id AND b.job = $1 AND b.platform = $2
|
||||||
b.main_binary = a.id
|
AND b.main_binary IS NOT NULL
|
||||||
WHERE b.job = $1 AND b.platform = $2 AND b.main_binary IS NOT NULL
|
|
||||||
ORDER BY b.start_d DESC, b.start_ps DESC
|
ORDER BY b.start_d DESC, b.start_ps DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
|}
|
|}
|
||||||
|
|
Loading…
Reference in a new issue