diff --git a/internal/db/schema/migrations/oss/postgres/31/01_delete_termianted_sessions.up.sql b/internal/db/schema/migrations/oss/postgres/31/01_delete_termianted_sessions.up.sql new file mode 100644 index 0000000000..9b0a49102d --- /dev/null +++ b/internal/db/schema/migrations/oss/postgres/31/01_delete_termianted_sessions.up.sql @@ -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;