Skip to content

Instantly share code, notes, and snippets.

@lfy79001
Created April 30, 2024 16:51
Show Gist options
  • Save lfy79001/fef99fe3761c9211908fc0e1f18fa138 to your computer and use it in GitHub Desktop.
Save lfy79001/fef99fe3761c9211908fc0e1f18fa138 to your computer and use it in GitHub Desktop.
WITH quantiles AS (
SELECT APPROX_QUANTILES(LOG10(latency), 50) AS timearray
FROM `cloud-datalab-samples.httplogs.logs_20140615`
WHERE latency <> 0
)
select row_number() over(order by time) as percentile, time from quantiles cross join unnest(quantiles.timearray) as time
order by percentile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment