Skip to content
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
31 changes: 31 additions & 0 deletions sql/2025/performance/early_hints_usage_rank.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#standardSQL
# Early Hints (HTTP 103) usage by site rank
# Measures the percentage of sites using early hints at different popularity ranks

SELECT
IF(ranking < 100000000, CAST(ranking AS STRING), 'all') AS ranking,
r.client,
COUNT(DISTINCT r.page) AS total_sites,
COUNTIF(JSON_QUERY_ARRAY(r.payload._early_hint_headers) IS NOT NULL) AS sites_with_early_hints,
COUNTIF(JSON_QUERY_ARRAY(r.payload._early_hint_headers) IS NOT NULL) / COUNT(DISTINCT r.page) AS pct_early_hints
FROM
`httparchive.crawl.requests` r
JOIN
`httparchive.crawl.pages` p
ON
r.page = p.page AND
r.client = p.client AND
r.date = p.date,
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS ranking
WHERE
r.date = '2025-07-01' AND
r.is_main_document AND
r.is_root_page AND
p.is_root_page AND
p.rank <= ranking
GROUP BY
ranking,
r.client
ORDER BY
ranking,
r.client
35 changes: 35 additions & 0 deletions sql/2025/performance/early_hints_usage_trends.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#standardSQL
# Early Hints (HTTP 103) adoption trend over time
# Shows usage by client (mobile, desktop) across years

SELECT
r.client AS client,
r.date AS date,
COUNTIF(
JSON_QUERY_ARRAY(r.payload._early_hint_headers) IS NOT NULL AND
ARRAY_LENGTH(JSON_QUERY_ARRAY(r.payload._early_hint_headers)) > 0
) AS sites,
COUNT(0) AS total,
COUNTIF(
JSON_QUERY_ARRAY(r.payload._early_hint_headers) IS NOT NULL AND
ARRAY_LENGTH(JSON_QUERY_ARRAY(r.payload._early_hint_headers)) > 0
) / COUNT(0) AS pct
FROM
`httparchive.crawl.requests` r
JOIN
`httparchive.crawl.pages` p
ON
r.page = p.page AND
r.client = p.client AND
r.date = p.date
WHERE
r.date IN ('2023-07-01', '2024-07-01', '2025-07-01') AND
r.is_main_document AND
r.is_root_page AND
p.is_root_page
GROUP BY
r.client,
r.date
ORDER BY
r.client,
r.date
29 changes: 29 additions & 0 deletions sql/2025/performance/speculation_rules_rank.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SELECT
IF(ranking < 100000000, CAST(ranking AS STRING), 'all') AS ranking,
client,
COUNT(DISTINCT page) AS total_sites,
COUNTIF(
custom_metrics.performance.speculation_rules IS NOT NULL AND (
ARRAY_LENGTH(JSON_QUERY_ARRAY(custom_metrics.performance.speculation_rules.htmlRules)) > 0 OR
ARRAY_LENGTH(JSON_QUERY_ARRAY(custom_metrics.performance.speculation_rules.httpHeaderRules)) > 0
)
) AS sites_with_speculation_rules,
COUNTIF(
custom_metrics.performance.speculation_rules IS NOT NULL AND (
ARRAY_LENGTH(JSON_QUERY_ARRAY(custom_metrics.performance.speculation_rules.htmlRules)) > 0 OR
ARRAY_LENGTH(JSON_QUERY_ARRAY(custom_metrics.performance.speculation_rules.httpHeaderRules)) > 0
)
) / COUNT(DISTINCT page) AS pct_speculation_rules
FROM
`httparchive.crawl.pages`,
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS ranking
WHERE
date = '2025-07-01' AND
is_root_page AND
rank <= ranking
GROUP BY
ranking,
client
ORDER BY
ranking,
client