Skip to content

Commit b75d956

Browse files
committed
early_hints_usage_rank.sql
1 parent 122ec52 commit b75d956

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#standardSQL
2+
# Early Hints (HTTP 103) usage by site rank
3+
# Measures the percentage of sites using early hints at different popularity ranks
4+
5+
SELECT
6+
IF(ranking < 100000000, CAST(ranking AS STRING), 'all') AS ranking,
7+
r.client,
8+
COUNT(DISTINCT r.page) AS total_sites,
9+
COUNTIF(JSON_QUERY_ARRAY(r.payload._early_hint_headers) IS NOT NULL) AS sites_with_early_hints,
10+
COUNTIF(JSON_QUERY_ARRAY(r.payload._early_hint_headers) IS NOT NULL) / COUNT(DISTINCT r.page) AS pct_early_hints
11+
FROM
12+
`httparchive.crawl.requests` r
13+
JOIN
14+
`httparchive.crawl.pages` p
15+
ON
16+
r.page = p.page AND
17+
r.client = p.client AND
18+
r.date = p.date,
19+
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS ranking
20+
WHERE
21+
r.date = '2025-07-01' AND
22+
r.is_main_document AND
23+
r.is_root_page AND
24+
p.is_root_page AND
25+
p.rank <= ranking
26+
GROUP BY
27+
ranking,
28+
r.client
29+
ORDER BY
30+
ranking,
31+
r.client

0 commit comments

Comments
 (0)