Skip to content

Instantly share code, notes, and snippets.

@rex-lin
Last active March 27, 2017 22:09
Show Gist options
  • Select an option

  • Save rex-lin/edbb6c11f61bee64594df0cd847a3e99 to your computer and use it in GitHub Desktop.

Select an option

Save rex-lin/edbb6c11f61bee64594df0cd847a3e99 to your computer and use it in GitHub Desktop.
AWS Session Duration
select date, sum(elapsed_time) as duration, count(distinct client_id) as user_count
from (
select event_timestamp::date as date, EXTRACT(SECOND FROM session_stop_timestamp-session_start_timestamp) as elapsed_time, client_id
from awsma.v_event
where event_timestamp between '2017-03-10' and '2017-03-13'
and event_type = '_session.stop'
and application_sdk_name = 'aws-sdk-iOS'
)
where elapsed_time <= 7200
and elapsed_time >= 0
group by 1
order by 1 asc
-----
select date, sum(elapsed_time) as duration, count(distinct client_id) as user_count
from (
select event_timestamp::date as date, EXTRACT(SECOND FROM session_stop_timestamp-session_start_timestamp) as elapsed_time, client_id
from awsma.v_event
where event_timestamp between '2017-03-10' and '2017-03-13'
and event_type = '_session.stop'
and application_sdk_name = 'aws-sdk-android'
)
where elapsed_time <= 7200
and elapsed_time >= 0
group by 1
order by 1 asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment