Skip to content

Commit

Permalink
Add query for average resource size
Browse files Browse the repository at this point in the history
  • Loading branch information
khempenius committed Sep 8, 2019
1 parent f97e2e8 commit 19ecd40
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
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_*`
GROUP BY
client
3 changes: 3 additions & 0 deletions sql/2019/18_Page_Weight/18_03.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#standardSQL
# 18_03: Distribution of response size by response format
SELECT
_TABLE_SUFFIX AS client,
percentile,
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
3 changes: 3 additions & 0 deletions sql/2019/18_Page_Weight/18_04.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#standardSQL
# 18_04: Distribution of response size by response type
SELECT
_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

0 comments on commit 19ecd40

Please sign in to comment.