Skip to content

Commit

Permalink
Merge pull request #135 from HTTPArchive/small-h2-query-improvement
Browse files Browse the repository at this point in the history
Small H2 query improvement
  • Loading branch information
tunetheweb authored Aug 29, 2021
2 parents 5a6c6f9 + b806458 commit 84a20c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sql/timeseries/h2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ SELECT
SUBSTR(_TABLE_SUFFIX, 0, 10) AS date,
UNIX_DATE(CAST(REPLACE(SUBSTR(_TABLE_SUFFIX, 0, 10), '_', '-') AS DATE)) * 1000 * 60 * 60 * 24 AS timestamp,
IF(ENDS_WITH(_TABLE_SUFFIX, 'desktop'), 'desktop', 'mobile') AS client,
ROUND(SUM(IF(JSON_EXTRACT_SCALAR(payload, '$._protocol') = 'HTTP/2', 1, 0)) * 100 / COUNT(0), 2) AS percent
ROUND(SUM(IF(protocol = 'HTTP/2', 1, 0)) * 100 / COUNT(0), 2) AS percent
FROM
(SELECT page AS url, payload, _TABLE_SUFFIX AS _TABLE_SUFFIX FROM `httparchive.requests.*`)
(SELECT page AS url, JSON_EXTRACT_SCALAR(payload, '$._protocol') AS protocol, _TABLE_SUFFIX AS _TABLE_SUFFIX FROM `httparchive.requests.*`)
GROUP BY
date,
timestamp,
Expand Down

0 comments on commit 84a20c1

Please sign in to comment.