Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page weight queries #126

Merged
merged 2 commits into from
Sep 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions sql/2019/18_Page_Weight/18_01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#standardSQL
# 18_01: Distribution of page weight by resource type and client.
khempenius marked this conversation as resolved.
Show resolved Hide resolved
SELECT
percentile,
_TABLE_SUFFIX as client,
APPROX_QUANTILES(ROUND(bytesTotal / 1024, 2), 1000)[OFFSET(percentile * 10)] AS total_kbytes,
APPROX_QUANTILES(ROUND(bytesHtml / 1024, 2), 1000)[OFFSET(percentile * 10)] AS html_kbytes,
APPROX_QUANTILES(ROUND(bytesJS / 1024, 2), 1000)[OFFSET(percentile * 10)] AS js_kbytes,
APPROX_QUANTILES(ROUND(bytesCSS / 1024, 2), 1000)[OFFSET(percentile * 10)] AS css_kbytes,
APPROX_QUANTILES(ROUND(bytesImg / 1024, 2), 1000)[OFFSET(percentile * 10)] AS img_kbytes,
APPROX_QUANTILES(ROUND(bytesOther / 1024, 2), 1000)[OFFSET(percentile * 10)] AS other_kbytes,
APPROX_QUANTILES(ROUND(bytesHtmlDoc / 1024, 2), 1000)[OFFSET(percentile * 10)] AS html_doc_kbytes
FROM
`httparchive.summary_pages.2019_07_01_*`,
UNNEST([10, 25, 50, 75, 90]) AS percentile
GROUP BY
percentile,
client
ORDER BY
client,
percentile
21 changes: 21 additions & 0 deletions sql/2019/18_Page_Weight/18_01b.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#standardSQL
# 18_01b: Distribution of page weight by resource type and client (2018).
SELECT
percentile,
_TABLE_SUFFIX as client,
APPROX_QUANTILES(ROUND(bytesTotal / 1024, 2), 1000)[OFFSET(percentile * 10)] AS total_kbytes,
APPROX_QUANTILES(ROUND(bytesHtml / 1024, 2), 1000)[OFFSET(percentile * 10)] AS html_kbytes,
APPROX_QUANTILES(ROUND(bytesJS / 1024, 2), 1000)[OFFSET(percentile * 10)] AS js_kbytes,
APPROX_QUANTILES(ROUND(bytesCSS / 1024, 2), 1000)[OFFSET(percentile * 10)] AS css_kbytes,
APPROX_QUANTILES(ROUND(bytesImg / 1024, 2), 1000)[OFFSET(percentile * 10)] AS img_kbytes,
APPROX_QUANTILES(ROUND(bytesOther / 1024, 2), 1000)[OFFSET(percentile * 10)] AS other_kbytes,
APPROX_QUANTILES(ROUND(bytesHtmlDoc / 1024, 2), 1000)[OFFSET(percentile * 10)] AS html_doc_kbytes
FROM
`httparchive.summary_pages.2018_07_01_*`,
UNNEST([10, 25, 50, 75, 90]) AS percentile
GROUP BY
percentile,
client
ORDER BY
client,
percentile
15 changes: 15 additions & 0 deletions sql/2019/18_Page_Weight/18_01c.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#standardSQL
# 18_01c: Average size of each of the resource types.
SELECT
_TABLE_SUFFIX as client,
ROUND(AVG(bytesTotal) / 1024,2) AS total_kbytes,
ROUND(AVG(bytesHtml) / 1024, 2) AS html_kbytes,
ROUND(AVG(bytesJS) / 1024, 2) AS js_kbytes,
ROUND(AVG(bytesCSS) / 1024, 2) AS css_kbytes,
ROUND(AVG(bytesImg) / 1024, 2) AS img_kbytes,
ROUND(AVG(bytesOther) / 1024, 2) AS other_kbytes,
ROUND(AVG(bytesHtmlDoc) / 1024, 2) AS html_doc_kbytes
FROM
`httparchive.summary_pages.2019_07_01_*`
khempenius marked this conversation as resolved.
Show resolved Hide resolved
GROUP BY
client
21 changes: 21 additions & 0 deletions sql/2019/18_Page_Weight/18_02.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#standardSQL
# 18_02: Distribution of requests by resource type and client
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
FROM
`httparchive.summary_pages.2019_07_01_*`,
UNNEST([10, 25, 50, 75, 90]) AS percentile
GROUP BY
percentile,
client
ORDER BY
client,
percentile
21 changes: 21 additions & 0 deletions sql/2019/18_Page_Weight/18_02b.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#standardSQL
# 18_02b: Distribution of requests by resource type and client (2018)
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
FROM
`httparchive.summary_pages.2018_07_01_*`,
UNNEST([10, 25, 50, 75, 90]) AS percentile
GROUP BY
percentile,
client
ORDER BY
client,
percentile
18 changes: 18 additions & 0 deletions sql/2019/18_Page_Weight/18_03.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
SELECT
_TABLE_SUFFIX AS client,
percentile,
khempenius marked this conversation as resolved.
Show resolved Hide resolved
format,
APPROX_QUANTILES(ROUND(respSize / 1024, 2), 1000)[OFFSET(percentile * 10)] AS resp_size
FROM
`httparchive.summary_requests.2019_07_01_*`,
UNNEST([10, 25, 50, 75, 90]) AS percentile
GROUP BY
client,
percentile,
format
ORDER BY
format,
client,
percentile
18 changes: 18 additions & 0 deletions sql/2019/18_Page_Weight/18_04.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
khempenius marked this conversation as resolved.
Show resolved Hide resolved
_TABLE_SUFFIX as client,
percentile,
type,
APPROX_QUANTILES(ROUND(respSize / 1024, 2), 1000)[OFFSET(percentile * 10)] AS resp_size
FROM
`httparchive.summary_requests.2019_07_01_*`,
UNNEST([10,25,50,75,90]) AS percentile
GROUP BY
client,
percentile,
type
ORDER BY
client,
type,
percentile