Embed Notice
HTML Code
Corresponding Notice
- Embed this noticeWe were down for a day or so. Now I have a delete job running on the activities table. It took me a day to tune it so it wouldn't lock the table. Everything seems fine over here since about yesterday when I got the job to not lock the table. Here's the the job:
do $$
declare
counter integer := 0;
begin
while counter < 100000 loop
DELETE FROM activities WHERE id = any (array(SELECT id FROM activities WHERE inserted_at < '2023-01-01' LIMIT 10));
COMMIT;
PERFORM pg_sleep(2);
counter := counter + 1;
end loop;
end$$;