feat(session): Add migration to delete terminated sessions

There is a new periodic job that will delete terminated sessions that
are older than one hour. However, since until now terminated sessions
were not deleted, the first time the job runs there could be a large
number of sessions that need deleted. This could have a negative impact
on a running cluster. To mitigate the operational risk, this adds a
migration to perform an initial delete while the cluster is offline.
pull/2160/head
Timothy Messier 4 years ago
parent f9eab71a4a
commit 5b0abe2e27
No known key found for this signature in database
GPG Key ID: EFD2F184F7600572

@ -0,0 +1,12 @@
begin;
delete from session
using session_state
where
session.public_id = session_state.session_id
and
session_state.state = 'terminated'
and
session_state.start_time < wt_sub_seconds_from_now(3600);
analyze;
commit;
Loading…
Cancel
Save