Skip to content

Instantly share code, notes, and snippets.

@zenorocha
Last active April 8, 2018 02:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zenorocha/94c2af21f73423f484178a9bf756c7c2 to your computer and use it in GitHub Desktop.
Save zenorocha/94c2af21f73423f484178a9bf756c7c2 to your computer and use it in GitHub Desktop.
Median Page Weight ~ BigQuery
SELECT
NTH(50, quantiles(INTEGER(bytesHtml/1024)))
+ NTH(50, quantiles(INTEGER(bytesHtmlDoc/1024)))
as html,
NTH(50, quantiles(INTEGER(bytesCSS/1024)))
as css,
NTH(50, quantiles(INTEGER(bytesJS/1024)))
as js,
NTH(50, quantiles(INTEGER(bytesImg/1024)))
+ NTH(50, quantiles(INTEGER(bytesGif/1024)))
+ NTH(50, quantiles(INTEGER(bytesJpg/1024)))
+ NTH(50, quantiles(INTEGER(bytesPng/1024)))
+ NTH(50, quantiles(INTEGER(bytesSvg/1024)))
+ NTH(50, quantiles(INTEGER(bytesWebp/1024)))
as image,
NTH(50, quantiles(INTEGER(bytesOther/1024)))
+ NTH(50, quantiles(INTEGER(bytesAudio/1024)))
+ NTH(50, quantiles(INTEGER(bytesFlash/1024)))
+ NTH(50, quantiles(INTEGER(bytesFont/1024)))
+ NTH(50, quantiles(INTEGER(bytesJson/1024)))
+ NTH(50, quantiles(INTEGER(bytesText/1024)))
+ NTH(50, quantiles(INTEGER(bytesXml/1024)))
+ NTH(50, quantiles(INTEGER(bytesVideo/1024)))
as other
FROM httparchive:runs.latest_pages
[
{
"html": "44",
"css": "36",
"js": "274",
"image": "1221",
"other": "42"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment