Skip to content

Instantly share code, notes, and snippets.

@seyhunak
Forked from mshakhomirov/login_ios_version.sql
Created January 20, 2022 11:50
Show Gist options
  • Save seyhunak/04fa8c2a73e3b682c48322ccb78c05d6 to your computer and use it in GitHub Desktop.
Save seyhunak/04fa8c2a73e3b682c48322ccb78c05d6 to your computer and use it in GitHub Desktop.

Revisions

  1. @mshakhomirov mshakhomirov created this gist Jul 16, 2020.
    23 changes: 23 additions & 0 deletions login_ios_version.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    select (case when tile = 50 then 'Median' when tile = 95 then '95%' else '5%' end) as tile
    , app_display_version
    , max(cast( ROUND(duration/1000)/1000 as numeric) ) max_duration_s
    , min(cast( ROUND(duration/1000)/1000 as numeric) ) min_duration_s

    from (
    select
    trace_info.duration_us duration
    , ntile(100) over (partition by (app_display_version) order by trace_info.duration_us) tile
    , app_display_version
    FROM `your-project-client.firebase_performance.your-project-client_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 app_display_version, tile
    order by app_display_version