Zalvena-Service/etc/clickhouse/queries/live_sessions__v1.liquid
2025-02-19 16:44:17 -05:00

15 lines
No EOL
504 B
Text
Executable file

SELECT session_id as Id,
min(min_timestamp) as StartedAt,
max(max_timestamp) - min(min_timestamp) as Duration,
countMerge(events_count) as EventsCount,
any(app_version) as AppVersion,
any(country_code) as CountryCode,
any(region_name) as RegionName,
any(os_name) as OsName,
any(os_version) as OsVersion
FROM sessions_live_v1
WHERE app_id = '{{app_id}}'
GROUP BY session_id
HAVING StartedAt >= now() - INTERVAL 1 HOUR
ORDER BY Duration DESC
LIMIT 6