advanced windowing MySQL MariaDB SQL Server PostgreSQL SQLite
Assign Session IDs Based on Inactivity Gaps
Group a stream of user events into sessions by labelling each event with a session ID that increments whenever the gap since the previous event exceeds a threshold.