From 557bf7aa7ec23dd114c67d0caa34c68885e6772f Mon Sep 17 00:00:00 2001 From: poveyd <32199157+poveyd@users.noreply.github.com> Date: Mon, 4 May 2020 15:55:24 +0100 Subject: [PATCH] Update cycle_notification_history_in_batches.sql --- database_maintenance/cycle_notification_history_in_batches.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/database_maintenance/cycle_notification_history_in_batches.sql b/database_maintenance/cycle_notification_history_in_batches.sql index f85e3542a..dc0651dc2 100644 --- a/database_maintenance/cycle_notification_history_in_batches.sql +++ b/database_maintenance/cycle_notification_history_in_batches.sql @@ -12,6 +12,8 @@ WHERE t.id = p.id; SELECT COUNT(*) AS "Number of rows remaining that need moving across from nh to nh_pivot" FROM nh_temp; +CREATE INDEX nh_temp_idx ON nh_temp (id); + -- In each function call, using same database connection as used for the above SQL (needs to be in a transaction; this can be inside a stored function or in a transaction from the code) INSERT INTO notification_history_pivot