aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-07-04 16:47:23 +0100
committerChristopher Baines <mail@cbaines.net>2020-07-04 16:47:23 +0100
commit2f42a84595903baba6667ae63ee4873ce56d1fdf (patch)
treec77a2697e0e2c0ba6963dffca6df2b8f7ee93b1c
parentab432800d362b61ac1fce99b98c5b2bdccdfd293 (diff)
downloadbuild-coordinator-2f42a84595903baba6667ae63ee4873ce56d1fdf.tar
build-coordinator-2f42a84595903baba6667ae63ee4873ce56d1fdf.tar.gz
Tweak the related-derivations-with-no-build-for-outputs for speed
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm25
1 files changed, 14 insertions, 11 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index b4c40a6..3f9b19e 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -293,21 +293,24 @@ UNION
INNER JOIN related_derivations
ON related_derivations.name = derivation_inputs.derivation_name
)
-SELECT DISTINCT related_derivations.name
+SELECT related_derivations.name
FROM related_derivations
INNER JOIN derivations
ON related_derivations.name = derivations.name
-INNER JOIN derivation_outputs
- ON related_derivations.name = derivation_outputs.derivation_name
WHERE related_derivations.name != :derivation
- AND derivation_outputs.output NOT IN (
- SELECT derivation_outputs.output
- FROM derivation_outputs
- INNER JOIN builds
- ON derivation_outputs.derivation_name = builds.derivation_name
- INNER JOIN derivations AS build_derivations
- ON builds.derivation_name = build_derivations.name
- WHERE build_derivations.system = derivations.system
+ AND NOT EXISTS (
+ SELECT 1
+ FROM builds
+ INNER JOIN derivation_outputs AS other_derivation_derivation_outputs
+ ON other_derivation_derivation_outputs.derivation_name =
+ builds.derivation_name
+ INNER JOIN derivations AS other_derivations
+ ON other_derivation_derivation_outputs.derivation_name =
+ other_derivations.name
+ INNER JOIN derivation_outputs
+ ON derivation_outputs.output = other_derivation_derivation_outputs.output
+ WHERE derivation_outputs.derivation_name = related_derivations.name
+ AND other_derivations.system = derivations.system
)
")))