Skip to content

Instantly share code, notes, and snippets.

@flokli
Last active November 13, 2023 17:03
Show Gist options
  • Save flokli/3c8fb545cddeb332caa4a7c956b2e8c9 to your computer and use it in GitHub Desktop.
Save flokli/3c8fb545cddeb332caa4a7c956b2e8c9 to your computer and use it in GitHub Desktop.
num requests and bytes sent per hour, nix-cache, 2023-11-10
SELECT
count(*) AS num_requests,
toStartOfInterval(fromUnixTimestamp(timestamp), toIntervalHour(1)) AS t,
SUM(bytes_sent)
FROM file('bucket_logs_2023-11-10-*.pq.zstd', 'Parquet', 'auto', 'zstd')
WHERE startsWith(key, 'nar/')
GROUP BY t
ORDER BY t ASC
Query id: 9573cb79-a4df-41fe-99a3-4af347a662a3
┌─num_requests─┬───────────────────t─┬─sum(bytes_sent)─┐
│ 11 │ 2023-11-09 22:00:00 │ 6134868 │
│ 65103 │ 2023-11-09 23:00:00 │ 40192786637 │
│ 115760 │ 2023-11-10 00:00:00 │ 58168833757 │
│ 82211 │ 2023-11-10 01:00:00 │ 50944475426 │
│ 105012 │ 2023-11-10 02:00:00 │ 56740096855 │
│ 96143 │ 2023-11-10 03:00:00 │ 50774897603 │
│ 102004 │ 2023-11-10 04:00:00 │ 49244015580 │
│ 93289 │ 2023-11-10 05:00:00 │ 43845653964 │
│ 99714 │ 2023-11-10 06:00:00 │ 60026093374 │
│ 89805 │ 2023-11-10 07:00:00 │ 53596746386 │
│ 148983 │ 2023-11-10 08:00:00 │ 89559122768 │
│ 141609 │ 2023-11-10 09:00:00 │ 82714657718 │
│ 124410 │ 2023-11-10 10:00:00 │ 69494635770 │
│ 116790 │ 2023-11-10 11:00:00 │ 63281164037 │
│ 101644 │ 2023-11-10 12:00:00 │ 50894821940 │
│ 121048 │ 2023-11-10 13:00:00 │ 62517813095 │
│ 139425 │ 2023-11-10 14:00:00 │ 79617899907 │
│ 115397 │ 2023-11-10 15:00:00 │ 62327301765 │
│ 115775 │ 2023-11-10 16:00:00 │ 61774383307 │
│ 106833 │ 2023-11-10 17:00:00 │ 51464129825 │
│ 117363 │ 2023-11-10 18:00:00 │ 42814933129 │
│ 110329 │ 2023-11-10 19:00:00 │ 52516127649 │
│ 95411 │ 2023-11-10 20:00:00 │ 51333685497 │
│ 106586 │ 2023-11-10 21:00:00 │ 52157345872 │
│ 92822 │ 2023-11-10 22:00:00 │ 45722397590 │
│ 671 │ 2023-11-10 23:00:00 │ 329584010 │
└──────────────┴─────────────────────┴─────────────────┘
26 rows in set. Elapsed: 7.420 sec. Processed 20.47 million rows, 1.36 GB (2.76 million rows/s., 183.37 MB/s.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment