Explain how SSL certificates and HTTP cache headers affect a web service in production.
Using the provided service, certificate, cache-header, and request tables, write a query that summarizes these production effects for each service as of 2025-03-08.
Output
- One row per service, including services without matching certificate, cache, or request records.
- Return
service_name, endpoint, certificate_status, cache_policy, request_count, average_response_ms, and cache_hit_rate_percent.
- Classify certificates as
valid, expiring, expired, or missing, and cache policies as revalidatable, cacheable, no-cache, or missing.
- Include requests from 2025-03-01 through 2025-03-08, and order by
endpoint ascending.
Output details
- Treat certificate expiration before
2025-03-08 as expired, and expiration through 2025-04-07 as expiring; classify later certificates as valid.
- Use only certificates where
is_current is true, retaining multiple matching current certificates as separate output rows.
- Match cache headers captured exactly on
2025-03-08; classify missing headers or NULL max_age_seconds as missing, zero as no-cache, true etag_present as revalidatable, and others as cacheable.
- Treat the request interval as inclusive of
2025-03-01 and exclusive of 2025-03-09.
- Round
average_response_ms and cache_hit_rate_percent to two decimal places, return NULL metrics without requests, and count only requests with cache_hit true as hits.
- Preserve the reference's unspecified database order when
endpoint values tie, without applying a secondary sort key.