mirror of
git://git.savannah.gnu.org/guix/data-service.git
synced 2023-12-14 03:23:03 +01:00
Speed up deleting blocked_builds entries
This commit is contained in:
parent
1bce38a69d
commit
2d96fbff48
|
@ -388,14 +388,28 @@ DELETE FROM builds WHERE id IN ("
|
||||||
(define (delete-blocked-builds-for-derivation-output-details-set
|
(define (delete-blocked-builds-for-derivation-output-details-set
|
||||||
conn
|
conn
|
||||||
derivation-output-details-set-id)
|
derivation-output-details-set-id)
|
||||||
(exec-query
|
;; Do this for each build server individually, as that helps PostgreSQL
|
||||||
conn
|
;; efficiently check the partitions
|
||||||
"
|
(let ((build-server-ids
|
||||||
|
(map
|
||||||
|
car
|
||||||
|
(exec-query
|
||||||
|
conn
|
||||||
|
"SELECT id FROM build_servers"))))
|
||||||
|
(for-each
|
||||||
|
(lambda (build-server-id)
|
||||||
|
(exec-query
|
||||||
|
conn
|
||||||
|
"
|
||||||
DELETE FROM blocked_builds
|
DELETE FROM blocked_builds
|
||||||
WHERE blocked_derivation_output_details_set_id = $1
|
WHERE build_server_id = $1
|
||||||
OR blocking_derivation_output_details_set_id = $2"
|
AND (
|
||||||
(list derivation-output-details-set-id
|
blocked_derivation_output_details_set_id = $2 OR blocking_derivation_output_details_set_id = $3
|
||||||
derivation-output-details-set-id)))
|
)"
|
||||||
|
(list build-server-id
|
||||||
|
derivation-output-details-set-id
|
||||||
|
derivation-output-details-set-id)))
|
||||||
|
build-server-ids)))
|
||||||
|
|
||||||
(define (delete-unreferenced-derivations-source-files conn)
|
(define (delete-unreferenced-derivations-source-files conn)
|
||||||
(exec-query
|
(exec-query
|
||||||
|
|
Loading…
Reference in a new issue