Skip to content

Commit

Permalink
Page weight 2021 Queries (#2352)
Browse files Browse the repository at this point in the history
* pageweight SQL queries

* new queries

* Update pageweight_by_header_body.sql

* Change to use 2021_07_01 dataset

* Change to use 2021_07_01 dataset

* Change to use 2021_07_01 dataset

* Change to use 2021_07_01 dataset

* Change to use 2021_07_01 dataset

* Change to use 2021_07_01 dataset

* Change to use 2021_07_01 dataset

* Change to use 2021_07_01 dataset

* Change to use 2021_07_01 dataset

* Fix indentation catch from linter

* Fix indentation catch from linter

* Fix indentation catch from linter

* Fix indentation catch from linter

* Fix indentation catch from linter

* Fix indentation catch from linter

* Fix spacing.

* Apply suggestions from code review

Co-authored-by: John Teague <[email protected]>
Co-authored-by: Rick Viscomi <[email protected]>
  • Loading branch information
3 people authored Oct 12, 2021
1 parent fbf25de commit d6df6a4
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sql/2021/page-weight/average_resource_size.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SELECT
_TABLE_SUFFIX AS client,
AVG(bytesTotal) / 1024 AS total_kbytes,
AVG(bytesHtml) / 1024 AS html_kbytes,
AVG(bytesJS) / 1024 AS js_kbytes,
AVG(bytesCSS) / 1024 AS css_kbytes,
AVG(bytesImg) / 1024 AS img_kbytes,
AVG(bytesOther) / 1024 AS other_kbytes,
AVG(bytesHtmlDoc) / 1024 AS html_doc_kbytes,
AVG(bytesFont) / 1024 AS font_kbytes
FROM
`httparchive.summary_pages.2021_07_01_*`
GROUP BY
client
23 changes: 23 additions & 0 deletions sql/2021/page-weight/bytes_per_type_2020.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#standardSQL
# 18_01b: Distribution of page weight by resource type and client (2020).
SELECT
percentile,
_TABLE_SUFFIX AS client,
APPROX_QUANTILES(bytesTotal / 1024, 1000)[OFFSET(percentile * 10)] AS total_kbytes,
APPROX_QUANTILES(bytesHtml / 1024, 1000)[OFFSET(percentile * 10)] AS html_kbytes,
APPROX_QUANTILES(bytesJS / 1024, 1000)[OFFSET(percentile * 10)] AS js_kbytes,
APPROX_QUANTILES(bytesCSS / 1024, 1000)[OFFSET(percentile * 10)] AS css_kbytes,
APPROX_QUANTILES(bytesImg / 1024, 1000)[OFFSET(percentile * 10)] AS img_kbytes,
APPROX_QUANTILES(bytesOther / 1024, 1000)[OFFSET(percentile * 10)] AS other_kbytes,
APPROX_QUANTILES(bytesHtmlDoc / 1024, 1000)[OFFSET(percentile * 10)] AS html_doc_kbytes,
APPROX_QUANTILES(bytesFont / 1024, 1000)[OFFSET(percentile * 10)] AS font_kbytes
FROM
`httparchive.summary_pages.2020_08_01_*`,

UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
client,
percentile
22 changes: 22 additions & 0 deletions sql/2021/page-weight/bytes_per_type_2021.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#standardSQL
# 18_01b: Distribution of page weight by resource type and client (2021).
SELECT
percentile,
_TABLE_SUFFIX AS client,
APPROX_QUANTILES(bytesTotal / 1024, 1000)[OFFSET(percentile * 10)] AS total_kbytes,
APPROX_QUANTILES(bytesHtml / 1024, 1000)[OFFSET(percentile * 10)] AS html_kbytes,
APPROX_QUANTILES(bytesJS / 1024, 1000)[OFFSET(percentile * 10)] AS js_kbytes,
APPROX_QUANTILES(bytesCSS / 1024, 1000)[OFFSET(percentile * 10)] AS css_kbytes,
APPROX_QUANTILES(bytesImg / 1024, 1000)[OFFSET(percentile * 10)] AS img_kbytes,
APPROX_QUANTILES(bytesOther / 1024, 1000)[OFFSET(percentile * 10)] AS other_kbytes,
APPROX_QUANTILES(bytesHtmlDoc / 1024, 1000)[OFFSET(percentile * 10)] AS html_doc_kbytes,
APPROX_QUANTILES(bytesFont / 1024, 1000)[OFFSET(percentile * 10)] AS font_kbytes
FROM
`httparchive.summary_pages.2021_07_01_*`,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
client,
percentile
9 changes: 9 additions & 0 deletions sql/2021/page-weight/group_responsesize_by_cdn.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT
_TABLE_SUFFIX AS client,
AVG(respSize) / 1024 AS resp_size,
_cdn_provider AS _cdn_provider
FROM
`httparchive.summary_requests.2021_07_01_*`
GROUP BY
client,
_cdn_provider
9 changes: 9 additions & 0 deletions sql/2021/page-weight/pageweight_by_header_body.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT
_TABLE_SUFFIX AS client,
AVG(reqHeadersSize) / 1024 AS request_header_size,
AVG(respHeadersSize) / 1024 AS response_header_size,
AVG(respBodySize) / 1024 AS response_body_size
FROM
`httparchive.summary_requests.2021_07_01_*`
GROUP BY
client
23 changes: 23 additions & 0 deletions sql/2021/page-weight/request_type_distribution_2020.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#standardSQL
# 728.9Mib: Distribution of requests by resource type and client (2020)
SELECT
percentile,
_TABLE_SUFFIX AS client,
APPROX_QUANTILES(reqTotal, 1000)[OFFSET(percentile * 10)] AS total_req,
APPROX_QUANTILES(reqHtml, 1000)[OFFSET(percentile * 10)] AS html_req,
APPROX_QUANTILES(reqJS, 1000)[OFFSET(percentile * 10)] AS js_req,
APPROX_QUANTILES(reqCSS, 1000)[OFFSET(percentile * 10)] AS css_req,
APPROX_QUANTILES(reqImg, 1000)[OFFSET(percentile * 10)] AS img_req,
APPROX_QUANTILES(reqJson, 1000)[OFFSET(percentile * 10)] AS json_req,
APPROX_QUANTILES(reqOther, 1000)[OFFSET(percentile * 10)] AS other_req,
APPROX_QUANTILES(reqFont, 1000)[OFFSET(percentile * 10)] AS font_req
FROM
`httparchive.summary_pages.2020_08_01_*`,

UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
client,
percentile
22 changes: 22 additions & 0 deletions sql/2021/page-weight/request_type_distribution_2021.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#standardSQL
# 18_02b: Distribution of requests by resource type and client (2021)
SELECT
percentile,
_TABLE_SUFFIX AS client,
APPROX_QUANTILES(reqTotal, 1000)[OFFSET(percentile * 10)] AS total_req,
APPROX_QUANTILES(reqHtml, 1000)[OFFSET(percentile * 10)] AS html_req,
APPROX_QUANTILES(reqJS, 1000)[OFFSET(percentile * 10)] AS js_req,
APPROX_QUANTILES(reqCSS, 1000)[OFFSET(percentile * 10)] AS css_req,
APPROX_QUANTILES(reqImg, 1000)[OFFSET(percentile * 10)] AS img_req,
APPROX_QUANTILES(reqJson, 1000)[OFFSET(percentile * 10)] AS json_req,
APPROX_QUANTILES(reqOther, 1000)[OFFSET(percentile * 10)] AS other_req,
APPROX_QUANTILES(reqFont, 1000)[OFFSET(percentile * 10)] AS font_req
FROM
`httparchive.summary_pages.2021_07_01_*`,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
client,
percentile
18 changes: 18 additions & 0 deletions sql/2021/page-weight/response_format_distribution.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#standardSQL
# 18_03: Distribution of response size by response format 2021
SELECT
_TABLE_SUFFIX AS client,
percentile,
format,
APPROX_QUANTILES(respSize / 1024, 1000)[OFFSET(percentile * 10)] AS resp_size
FROM
`httparchive.summary_requests.2021_07_01_*`,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
client,
percentile,
format
ORDER BY
format,
client,
percentile
18 changes: 18 additions & 0 deletions sql/2021/page-weight/response_type_distribution.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#standardSQL
# 18_04: Distribution of response size by response type
SELECT
_TABLE_SUFFIX AS client,
percentile,
type,
APPROX_QUANTILES(respSize / 1024, 1000)[OFFSET(percentile * 10)] AS resp_size
FROM
`httparchive.summary_requests.2021_07_01_*`,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
client,
percentile,
type
ORDER BY
client,
type,
percentile

0 comments on commit d6df6a4

Please sign in to comment.