|
2 | 2 | # The distribution of cache header adoption on websites by client. |
3 | 3 |
|
4 | 4 | SELECT |
5 | | - client, |
6 | | - COUNT(*) AS total_requests, |
| 5 | + client, |
| 6 | + COUNT(*) AS total_requests, |
7 | 7 |
|
8 | | - COUNTIF(uses_cache_control) AS total_using_cache_control, |
9 | | - COUNTIF(uses_max_age) AS total_using_max_age, |
10 | | - COUNTIF(uses_expires) AS total_using_expires, |
11 | | - COUNTIF(uses_max_age AND uses_expires) AS total_using_max_age_and_expires, |
12 | | - COUNTIF( |
13 | | - uses_cache_control AND uses_expires |
14 | | - ) AS total_using_both_cc_and_expires, |
15 | | - COUNTIF( |
16 | | - NOT uses_cache_control AND NOT uses_expires |
17 | | - ) AS total_using_neither_cc_and_expires, |
18 | | - COUNTIF( |
19 | | - uses_cache_control AND NOT uses_expires |
20 | | - ) AS total_using_only_cache_control, |
21 | | - COUNTIF( |
22 | | - NOT uses_cache_control AND uses_expires |
23 | | - ) AS total_using_only_expires, |
| 8 | + COUNTIF(uses_cache_control) AS total_using_cache_control, |
| 9 | + COUNTIF(uses_max_age) AS total_using_max_age, |
| 10 | + COUNTIF(uses_expires) AS total_using_expires, |
| 11 | + COUNTIF(uses_max_age AND uses_expires) AS total_using_max_age_and_expires, |
| 12 | + COUNTIF( |
| 13 | + uses_cache_control AND uses_expires |
| 14 | + ) AS total_using_both_cc_and_expires, |
| 15 | + COUNTIF( |
| 16 | + NOT uses_cache_control AND NOT uses_expires |
| 17 | + ) AS total_using_neither_cc_and_expires, |
| 18 | + COUNTIF( |
| 19 | + uses_cache_control AND NOT uses_expires |
| 20 | + ) AS total_using_only_cache_control, |
| 21 | + COUNTIF( |
| 22 | + NOT uses_cache_control AND uses_expires |
| 23 | + ) AS total_using_only_expires, |
24 | 24 |
|
25 | | - COUNTIF(uses_cache_control) / COUNT(*) AS pct_cache_control, |
26 | | - COUNTIF(uses_max_age) / COUNT(*) AS pct_using_max_age, |
27 | | - COUNTIF(uses_expires) / COUNT(*) AS pct_using_expires, |
28 | | - COUNTIF( |
29 | | - uses_max_age AND uses_expires |
30 | | - ) / COUNT(*) AS pct_using_max_age_and_expires, |
31 | | - COUNTIF( |
32 | | - uses_cache_control AND uses_expires |
33 | | - ) / COUNT(*) AS pct_using_both_cc_and_expires, |
34 | | - COUNTIF( |
35 | | - NOT uses_cache_control AND NOT uses_expires |
36 | | - ) / COUNT(*) AS pct_using_neither_cc_nor_expires, |
37 | | - COUNTIF( |
38 | | - uses_cache_control AND NOT uses_expires |
39 | | - ) / COUNT(*) AS pct_using_only_cache_control, |
40 | | - COUNTIF( |
41 | | - NOT uses_cache_control AND uses_expires |
42 | | - ) / COUNT(*) AS pct_using_only_expires |
| 25 | + COUNTIF(uses_cache_control) / COUNT(*) AS pct_cache_control, |
| 26 | + COUNTIF(uses_max_age) / COUNT(*) AS pct_using_max_age, |
| 27 | + COUNTIF(uses_expires) / COUNT(*) AS pct_using_expires, |
| 28 | + COUNTIF( |
| 29 | + uses_max_age AND uses_expires |
| 30 | + ) / COUNT(*) AS pct_using_max_age_and_expires, |
| 31 | + COUNTIF( |
| 32 | + uses_cache_control AND uses_expires |
| 33 | + ) / COUNT(*) AS pct_using_both_cc_and_expires, |
| 34 | + COUNTIF( |
| 35 | + NOT uses_cache_control AND NOT uses_expires |
| 36 | + ) / COUNT(*) AS pct_using_neither_cc_nor_expires, |
| 37 | + COUNTIF( |
| 38 | + uses_cache_control AND NOT uses_expires |
| 39 | + ) / COUNT(*) AS pct_using_only_cache_control, |
| 40 | + COUNTIF( |
| 41 | + NOT uses_cache_control AND uses_expires |
| 42 | + ) / COUNT(*) AS pct_using_only_expires |
43 | 43 |
|
44 | 44 | FROM ( |
45 | | - SELECT |
46 | | - client, |
| 45 | + SELECT |
| 46 | + client, |
47 | 47 |
|
48 | | - JSON_EXTRACT_SCALAR( |
49 | | - summary, '$.resp_expires' |
50 | | - ) IS NOT NULL AND TRIM( |
51 | | - JSON_EXTRACT_SCALAR(summary, '$.resp_expires') |
52 | | - ) != '' AS uses_expires, |
53 | | - JSON_EXTRACT_SCALAR( |
54 | | - summary, '$.resp_cache_control' |
55 | | - ) IS NOT NULL AND TRIM( |
56 | | - JSON_EXTRACT_SCALAR(summary, '$.resp_cache_control') |
57 | | - ) != '' AS uses_cache_control, |
58 | | - REGEXP_CONTAINS( |
59 | | - JSON_EXTRACT_SCALAR(summary, '$.resp_cache_control'), |
60 | | - r'(?i)max-age\s*=\s*[0-9]+' |
61 | | - ) AS uses_max_age, |
| 48 | + JSON_EXTRACT_SCALAR( |
| 49 | + summary, '$.resp_expires' |
| 50 | + ) IS NOT NULL AND TRIM( |
| 51 | + JSON_EXTRACT_SCALAR(summary, '$.resp_expires') |
| 52 | + ) != '' AS uses_expires, |
| 53 | + JSON_EXTRACT_SCALAR( |
| 54 | + summary, '$.resp_cache_control' |
| 55 | + ) IS NOT NULL AND TRIM( |
| 56 | + JSON_EXTRACT_SCALAR(summary, '$.resp_cache_control') |
| 57 | + ) != '' AS uses_cache_control, |
| 58 | + REGEXP_CONTAINS( |
| 59 | + JSON_EXTRACT_SCALAR(summary, '$.resp_cache_control'), |
| 60 | + r'(?i)max-age\s*=\s*[0-9]+' |
| 61 | + ) AS uses_max_age, |
62 | 62 |
|
63 | | - JSON_EXTRACT_SCALAR( |
64 | | - summary, '$.resp_etag' |
65 | | - ) IS NULL OR TRIM( |
66 | | - JSON_EXTRACT_SCALAR(summary, '$.resp_etag') |
67 | | - ) = '' AS uses_no_etag, |
68 | | - JSON_EXTRACT_SCALAR( |
69 | | - summary, '$.resp_etag' |
70 | | - ) IS NOT NULL AND TRIM( |
71 | | - JSON_EXTRACT_SCALAR(summary, '$.resp_etag') |
72 | | - ) != '' AS uses_etag, |
73 | | - JSON_EXTRACT_SCALAR( |
74 | | - summary, '$.resp_last_modified' |
75 | | - ) IS NOT NULL AND TRIM( |
76 | | - JSON_EXTRACT_SCALAR(summary, '$.resp_last_modified') |
77 | | - ) != '' AS uses_last_modified, |
| 63 | + JSON_EXTRACT_SCALAR( |
| 64 | + summary, '$.resp_etag' |
| 65 | + ) IS NULL OR TRIM( |
| 66 | + JSON_EXTRACT_SCALAR(summary, '$.resp_etag') |
| 67 | + ) = '' AS uses_no_etag, |
| 68 | + JSON_EXTRACT_SCALAR( |
| 69 | + summary, '$.resp_etag' |
| 70 | + ) IS NOT NULL AND TRIM( |
| 71 | + JSON_EXTRACT_SCALAR(summary, '$.resp_etag') |
| 72 | + ) != '' AS uses_etag, |
| 73 | + JSON_EXTRACT_SCALAR( |
| 74 | + summary, '$.resp_last_modified' |
| 75 | + ) IS NOT NULL AND TRIM( |
| 76 | + JSON_EXTRACT_SCALAR(summary, '$.resp_last_modified') |
| 77 | + ) != '' AS uses_last_modified, |
78 | 78 |
|
79 | | - REGEXP_CONTAINS( |
80 | | - TRIM(JSON_EXTRACT_SCALAR(summary, '$.resp_etag')), '^W/".*"' |
81 | | - ) AS uses_weak_etag, |
82 | | - REGEXP_CONTAINS( |
83 | | - TRIM(JSON_EXTRACT_SCALAR(summary, '$.resp_etag')), '^".*"' |
84 | | - ) AS uses_strong_etag |
| 79 | + REGEXP_CONTAINS( |
| 80 | + TRIM(JSON_EXTRACT_SCALAR(summary, '$.resp_etag')), '^W/".*"' |
| 81 | + ) AS uses_weak_etag, |
| 82 | + REGEXP_CONTAINS( |
| 83 | + TRIM(JSON_EXTRACT_SCALAR(summary, '$.resp_etag')), '^".*"' |
| 84 | + ) AS uses_strong_etag |
85 | 85 |
|
86 | | - FROM |
87 | | - `httparchive.crawl.requests` |
88 | | - WHERE |
89 | | - date = '2025-06-01' |
| 86 | + FROM |
| 87 | + `httparchive.crawl.requests` |
| 88 | + WHERE |
| 89 | + date = '2025-06-01' |
90 | 90 | ) |
91 | 91 |
|
92 | 92 | GROUP BY |
93 | | - client |
| 93 | + client |
94 | 94 | ORDER BY |
95 | | - client; |
| 95 | + client; |
0 commit comments