Vacuum the package derivations table after each job

As each job deletes lots of rows in the table, vacuum it to free up space for
the next job.

I don't think this is something to do widely, but I wanted to try it out for
the tables which have a lot of churn.
This commit is contained in:
Christopher Baines 2020-11-17 20:47:16 +00:00
parent 5fb3fa177d
commit e07b3291e8
2 changed files with 11 additions and 0 deletions

View file

@ -1758,6 +1758,11 @@ SKIP LOCKED")
(record-job-succeeded conn id)
(record-job-event conn id "success")
(exec-query conn "COMMIT")
(with-time-logging
"vacuuming package derivations by guix revision range table"
(vacuum-package-derivations-table conn))
#t)
(begin
(exec-query conn "ROLLBACK")

View file

@ -23,6 +23,7 @@
#:export (delete-guix-revision-package-derivation-entries
insert-guix-revision-package-derivation-entries
update-package-derivations-table
vacuum-package-derivations-table
rebuild-package-derivations-table))
(define (delete-guix-revision-package-derivation-entries conn
@ -149,6 +150,11 @@ LOCK TABLE ONLY package_derivations_by_guix_revision_range
#t)
(define (vacuum-package-derivations-table conn)
(exec-query
conn
"VACUUM package_derivations_by_guix_revision_range"))
(define (rebuild-package-derivations-table conn)
(with-postgresql-transaction
conn