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.
This commit is contained in:
1 file changed
+12
@@ -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;
|
||||
Reference in new issue
Block a user