Last active
August 22, 2022 18:35
-
-
Save adamsilverstein/181ff3461f81a203743d03867f41d6ca to your computer and use it in GitHub Desktop.
Calculate the median image size for WordPress pages using/not using WebP images. Change mobile to desktop for desktop sizes.
This file contains hidden or 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 | |
has_webp, | |
APPROX_QUANTILES(bytesImg, 1000)[OFFSET(500)] / 1024 / 1024 AS median_img_mbytes | |
FROM ( | |
SELECT DISTINCT | |
url, | |
info AS version | |
FROM | |
`httparchive.technologies.2022_07_01_mobile` | |
WHERE | |
app = 'WordPress') | |
JOIN ( | |
SELECT | |
url, | |
has_webp, | |
bytesImg | |
FROM ( | |
SELECT | |
pageid, | |
COUNTIF(ext = 'webp') > 0 AS has_webp | |
FROM | |
`httparchive.summary_requests.2022_07_01_mobile` | |
GROUP BY | |
pageid) | |
JOIN ( | |
SELECT | |
pageid, | |
url, | |
bytesImg | |
FROM | |
`httparchive.summary_pages.2022_07_01_mobile`) | |
USING | |
(pageid)) | |
USING | |
(url) | |
GROUP BY | |
has_webp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment