Created
November 24, 2022 15:21
-
-
Save mshakhomirov/16fe941aa8c4ed79e4aad8b7049b307a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select (case when tile = 50 then 'median' when tile = 95 then '95%' else '5%' end) as tile | |
, dt | |
, 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 (date(event_timestamp)) order by trace_info.duration_us) tile | |
, date(event_timestamp) dt | |
from firebase_performance.my_mobile_app | |
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 lower(event_type) = "duration_trace" | |
and lower(event_name) = 'logon' | |
) x | |
WHERE tile in (5, 50, 95) | |
group by dt, tile | |
order by dt | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment