Insert derivation inputs in chunks
To avoid one massive query.
This commit is contained in:
parent
d5ab67000e
commit
857b4e32d5
1 changed files with 10 additions and 7 deletions
|
|
@ -1354,6 +1354,8 @@ WHERE derivation_source_files.store_path = $1"
|
|||
derivations)))
|
||||
|
||||
(unless (null? data)
|
||||
(for-each
|
||||
(lambda (chunk)
|
||||
(exec-query
|
||||
conn
|
||||
(string-append
|
||||
|
|
@ -1361,13 +1363,14 @@ WHERE derivation_source_files.store_path = $1"
|
|||
INSERT INTO derivation_inputs (derivation_id, derivation_output_id)
|
||||
SELECT vals.derivation_id, derivation_outputs.id
|
||||
FROM (VALUES "
|
||||
(string-join data ", ")
|
||||
(string-join chunk ", ")
|
||||
") AS vals (derivation_id, file_name, output_name)
|
||||
INNER JOIN derivations
|
||||
ON derivations.file_name = vals.file_name
|
||||
INNER JOIN derivation_outputs
|
||||
ON derivation_outputs.derivation_id = derivations.id
|
||||
AND vals.output_name = derivation_outputs.name")))))
|
||||
AND vals.output_name = derivation_outputs.name")))
|
||||
(chunk! data 1000)))))
|
||||
|
||||
(define (select-from-derivation-source-files store-paths)
|
||||
(string-append
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue