-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathbfcache_unload.sql
More file actions
39 lines (37 loc) · 737 Bytes
/
bfcache_unload.sql
File metadata and controls
39 lines (37 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
CREATE TEMPORARY FUNCTION getUnloadHandler(audit STRING)
RETURNS BOOL LANGUAGE js AS '''
try {
var $ = JSON.parse(audit);
return $.details?.items?.some(n => n.value?.toLowerCase() === "unloadhandler");
} catch (e) {
return false;
}
''';
WITH lh AS (
SELECT
client,
page,
rank,
getUnloadHandler(JSON_EXTRACT(lighthouse, '$.audits.deprecations')) AS has_unload
FROM
`httparchive.all.pages`
WHERE
date = '2024-06-01'
)
SELECT
client,
_rank AS rank,
COUNTIF(has_unload) AS pages,
COUNT(0) AS total,
COUNTIF(has_unload) / COUNT(0) AS pct
FROM
lh,
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS _rank
WHERE
rank <= _rank
GROUP BY
client,
rank
ORDER BY
rank,
client