Skip to content

Instantly share code, notes, and snippets.

@mshakhomirov
Created July 16, 2020 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mshakhomirov/6ab395e0e9aeea156197fc3a73893a9e to your computer and use it in GitHub Desktop.
Save mshakhomirov/6ab395e0e9aeea156197fc3a73893a9e to your computer and use it in GitHub Desktop.
select (case when tile = 50 then 'Median' when tile = 95 then '95%' else '5%' end) as tile
, radio_type
, max(cast( ROUND(duration/1000) as numeric)/1000 ) max_duration_s
, min(cast( ROUND(duration/1000) as numeric)/1000 ) min_duration_s
from (
select
trace_info.duration_us duration
, ntile(100) over (partition by (radio_type) order by trace_info.duration_us) tile
, radio_type
FROM `your-project-client.firebase_performance.your-project_IOS`
WHERE DATE(_PARTITIONTIME) >= PARSE_DATE('%Y%m%d', @DS_START_DATE) AND DATE(_PARTITIONTIME) <= PARSE_DATE('%Y%m%d', @DS_END_DATE)
AND
date(event_timestamp) >= PARSE_DATE('%Y%m%d', @DS_START_DATE)
AND
date(event_timestamp) <= PARSE_DATE('%Y%m%d', @DS_END_DATE)
AND event_type = "DURATION_TRACE"
AND event_name = 'Logon'
) x
WHERE tile in (5, 50, 95)
group by radio_type, tile
order by radio_type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment