Skip to main content

// advent-of-postgres/day-12

Day 12 of 24Intermediaterow_numberTop N per group

The Noisy Alerts

Every team gets to silence its three noisiest alert rules. Rank the rules per team, not across the whole company.

Opens 12 December 2026, 00:00 UTC

Alert fatigue is real at the North Pole. The new policy: each team may silence its three noisiest alert rules for the rest of December. Sugarplum wants to know how many alerts that would have removed on 12 December.

Every alert that fired on 12 December (UTC) is in alerts, and nothing else is, so count every row:

Column Type Notes
id int Primary key
team text The team that owns the rule
rule text The alert rule that fired
fired_at timestamptz When it fired

A rule's noise is how many times it fired. If two rules of a team fired the same number of times, the one whose name comes first alphabetically ranks higher.

Your task

Take each team's three noisiest rules. How many alerts did those rules fire in total?

Submit the number.

Stuck? Show a hint

Count per team and rule first, then use row_number() OVER (PARTITION BY team ORDER BY count DESC, rule).

No database yet. You get a real Postgres database on Neon, free, with no account.
One statement at a time. Ctrl+Enter or Cmd+Enter runs it.

Download today's data as SQL to solve it on your own Postgres (14 or later).

Solved this puzzle? Share it.

Tag @thedevopsdaily and share it with the community.