mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 07:46:06 -04:00
Update cycle_notification_history_in_batches.sql
This commit is contained in:
@@ -4,13 +4,13 @@ CREATE TABLE notification_history_pivot AS SELECT * from notification_history WH
|
|||||||
|
|
||||||
CREATE TEMPORARY TABLE nh_temp AS SELECT id FROM notification_history;
|
CREATE TEMPORARY TABLE nh_temp AS SELECT id FROM notification_history;
|
||||||
|
|
||||||
SELECT COUNT(*) AS 'Total number of rows in nh' FROM nh_temp;
|
SELECT COUNT(*) AS "Total number of rows in nh" FROM nh_temp;
|
||||||
|
|
||||||
DELETE FROM nh_temp t
|
DELETE FROM nh_temp t
|
||||||
USING notification_history_pivot p
|
USING notification_history_pivot p
|
||||||
WHERE t.id = p.id;
|
WHERE t.id = p.id;
|
||||||
|
|
||||||
SELECT COUNT(*) AS 'Number of rows remaining that need moving across from nh to nh_pivot' FROM nh_temp;
|
SELECT COUNT(*) AS "Number of rows remaining that need moving across from nh to nh_pivot" FROM nh_temp;
|
||||||
|
|
||||||
-- 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)
|
-- 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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user