Query 10+ billion GitHub events for security investigations.
Author: Rufio @ Permiso Security
Use Case: Built during the Trivy supply chain compromise investigation (March 2026)
bash
curl -s "https://play.clickhouse.com/?user=play" \
--data "SELECT ... FROM github_events WHERE ... FORMAT PrettyCompact"
https://play.clickhouse.com/?user=playgithub_eventsColumnTypeUsecreated_atDateTimeEvent timestampevent_typeEnumPushEvent, CreateEvent, DeleteEvent, ReleaseEvent, etc.actor_loginStringGitHub usernamerepo_nameStringowner/repo formatrefStringBranch/tag name (e.g., refs/heads/main, 0.33.0)ref_typeEnumbranch, tag, repository, none``actionEnumpublished, created, opened, closed, etc.
For full schema (29 columns): see references/schema.md
sql
SELECT created_at, event_type, repo_name, ref, action
FROM github_events
WHERE actor_login = 'TARGET_ACCOUNT'
AND created_at >= '2026-03-01'
ORDER BY created_at
sql
SELECT created_at, event_type, actor_login, ref, ref_type, action
FROM github_events
WHERE repo_name = 'owner/repo'
AND created_at >= 'START_TIME'
AND created_at <= 'END_TIME'
ORDER BY created_at
sql
SELECT repo_name,
countIf(created_at < 'ATTACK_DATE') as before,
countIf(created_at >= 'ATTACK_DATE') as during
FROM github_events
WHERE actor_login = 'SUSPECT_ACCOUNT'
AND created_at >= 'LOOKBACK_START'
GROUP BY repo_name
ORDER BY during DESC
sql
SELECT created_at, event_type, actor_login, ref, ref_type
FROM github_events
WHERE repo_name = 'owner/repo'
AND event_type IN ('CreateEvent', 'DeleteEvent', 'ReleaseEvent')
AND ref_type = 'tag'
ORDER BY created_at
sql
SELECT toStartOfMonth(created_at) as month,
count() as events,
uniqExact(repo_name) as unique_repos
FROM github_events
WHERE actor_login = 'TARGET_ACCOUNT'
GROUP BY month
ORDER BY month
sql
SELECT created_at, event_type, actor_login, repo_name, ref
FROM github_events
WHERE repo_name LIKE 'orgname/%'
AND created_at >= 'START_TIME'
ORDER BY created_at
sql
SELECT actor_login, min(created_at) as first_ever, count() as events
FROM github_events
WHERE repo_name LIKE 'orgname/%'
GROUP BY actor_login
HAVING first_ever >= 'INCIDENT_START' AND first_ever <= 'INCIDENT_END'
ORDER BY first_ever
sql
SELECT toStartOfHour(created_at) as hour,
actor_login,
count() as events,
groupArray(distinct repo_name) as repos,
groupArray(distinct event_type) as types
FROM github_events
WHERE repo_name LIKE 'orgname/%'
AND created_at >= 'START_TIME'
GROUP BY hour, actor_login
ORDER BY hour
EventSignificancePushEventCode pushed to branchCreateEventBranch/tag/repo createdDeleteEventBranch/tag deletedReleaseEventRelease published/editedPullRequestEventPR opened/closed/mergedIssueCommentEventComment on issueForkEventRepo forkedWatchEventRepo starred
FORMAT PrettyCompact for tables, FORMAT TabSeparated for parsing--data not -d for multi-line queriesYYYY-MM-DD HH:MM:SSactor_login NOT IN ('github-actions[bot]', 'dependabot[bot]')play.clickhouse.com