From 2ea78cff47fd05d658a5f3c02f64f44c4404d995 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 7 Jul 2019 21:23:18 +0100 Subject: 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. --- sqitch/sqitch.plan | 1 + 1 file changed, 1 insertion(+) (limited to 'sqitch/sqitch.plan') diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index a03da58..7a37548 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -14,3 +14,4 @@ license_support 2019-05-13T20:37:40Z Christopher Baines # Add dates_to_load_new_guix_revision_jobs 2019-06-02T07:39:49Z Christopher Baines # Add dates to the load_new_guix_revision_jobs table load_new_guix_revision_job_events 2019-06-02T15:44:41Z Christopher Baines # Add new table for guix_revision_job_events load_new_guix_revision_job_logs 2019-06-21T14:33:09Z chris # Add load_new_guix_revision_job_logs +change_load_new_guix_revision_job_logs_contents_to_be_nullable 2019-07-07T20:10:54Z Christopher Baines # Change the contents field in the load_new_guix_revision_job_logs table\nto be nullable.\n\nwith '#' will # be ignored, and an empty message aborts the add. #\nChange to add: # #\nchange_load_new_guix_revision_job_logs_contents_to_be_nullable #\nsqitch/deploy/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql\nsqitch/revert/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql\nsqitch/verify/change_load_new_guix_revision_job_logs_contents_to_be_nullable.sql -- cgit v1.2.3