diff options
author | Christopher Baines <mail@cbaines.net> | 2020-10-13 19:32:42 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-10-13 19:35:40 +0100 |
commit | e273e220420f7f0351824fefb32d0c6c423e5dc3 (patch) | |
tree | ebb597a4f72383ba6c21a778543a96510cbc7540 /guix-data-service/model/derivation.scm | |
parent | 83884ed2ea4369d88b5a323333a6c78dbc471d24 (diff) | |
download | data-service-e273e220420f7f0351824fefb32d0c6c423e5dc3.tar data-service-e273e220420f7f0351824fefb32d0c6c423e5dc3.tar.gz |
Switch queries across to use latest_build_status
Diffstat (limited to 'guix-data-service/model/derivation.scm')
-rw-r--r-- | guix-data-service/model/derivation.scm | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm index 6ec0266..05b96c9 100644 --- a/guix-data-service/model/derivation.scm +++ b/guix-data-service/model/derivation.scm @@ -157,11 +157,7 @@ LEFT OUTER JOIN builds builds.derivation_output_details_set_id LEFT OUTER JOIN build_servers ON builds.build_server_id = build_servers.id -LEFT OUTER JOIN ( - SELECT DISTINCT ON (build_id) * - FROM build_status - ORDER BY build_id, id DESC -) AS latest_build_status +LEFT OUTER JOIN latest_build_status ON builds.id = latest_build_status.build_id WHERE guix_revisions.commit = $1 AND packages.name = $2 @@ -261,11 +257,7 @@ SELECT derivations.file_name, ORDER BY latest_build_status.timestamp ) FROM builds - INNER JOIN ( - SELECT DISTINCT ON (build_id) * - FROM build_status - ORDER BY build_id, id DESC - ) AS latest_build_status + INNER JOIN latest_build_status ON builds.id = latest_build_status.build_id WHERE builds.derivation_output_details_set_id = derivations_by_output_details_set.derivation_output_details_set_id @@ -390,11 +382,7 @@ SELECT derivations.file_name, ORDER BY latest_build_status.timestamp ) FROM builds - INNER JOIN ( - SELECT DISTINCT ON (build_id) * - FROM build_status - ORDER BY build_id, id DESC - ) AS latest_build_status + INNER JOIN latest_build_status ON builds.id = latest_build_status.build_id WHERE builds.derivation_output_details_set_id = derivations_by_output_details_set.derivation_output_details_set_id @@ -1445,11 +1433,7 @@ INNER JOIN derivations_by_output_details_set LEFT OUTER JOIN builds ON derivations.derivation_output_details_set_id = builds.derivation_output_details_set_id -LEFT OUTER JOIN ( - SELECT DISTINCT ON (build_id) * - FROM build_status - ORDER BY build_id, id DESC -) AS latest_build_status +LEFT OUTER JOIN latest_build_status ON builds.id = latest_build_status.build_id WHERE " criteria ";")) |