diff options
author | Christopher Baines <mail@cbaines.net> | 2019-07-07 21:23:18 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-07-07 21:23:18 +0100 |
commit | 2ea78cff47fd05d658a5f3c02f64f44c4404d995 (patch) | |
tree | 1b55460dc9bb49ca1d4a5758b3fbd34aa9da5bb0 /sqitch/revert | |
parent | c00405e23273d998f77ab930d209062ea892aa10 (diff) | |
download | data-service-2ea78cff47fd05d658a5f3c02f64f44c4404d995.tar data-service-2ea78cff47fd05d658a5f3c02f64f44c4404d995.tar.gz |
Tweak how logs are stored
Previously, the query for the jobs page was really slow, as it checked the
load_new_guix_revision_job_log_parts table for each job, doing a sequential
scan through the potentially large table.
Adding an index didn't seem to help, as the query planner would belive the
query could return loads of rows, where actually, all that needed checking is
whether a single row existed with a given job_id.
To avoid adding the index to the load_new_guix_revision_job_log_parts table,
and fighting with the query planner, this commit changes the
load_new_guix_revision_job_logs table to include a blank entry for jobs which
are currently being processed. This is inserted at the start of the job, and
then updated at the end to combine and replace all the parts.
This all means that the jobs page should render quickly now.
Diffstat (limited to 'sqitch/revert')
-rw-r--r-- | sqitch/revert/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sqitch/revert/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql b/sqitch/revert/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql new file mode 100644 index 0000000..509aace --- /dev/null +++ b/sqitch/revert/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:change_load_new_guix_revision_job_logs_contents_to_be_nullable from pg + +BEGIN; + +ALTER TABLE load_new_guix_revision_job_logs ALTER contents SET NOT NULL; + +COMMIT; |