Why does a fraud alert arrive in seconds and a year-end recap takes a year?
Lesson 3.4 · Right Now or Later?
Felix · Owen
Fraud alert: instant. Year in review: December.
Felix’s card gets flagged for a weird purchase and his phone buzzes before he’s left the store.
The same week, a music app sends everyone a recap of their whole year. Both are data. One took a second. One took twelve months.
The short answer
Because a late fraud alert is useless and a late recap is fine. The bank streams every purchase through a model as it happens. The music app waits, piles up a year of plays, and runs one big batch in December.
Try it yourself
Sort each event. Does it need handling the second it happens, or can it wait and get handled later with a pile of others?
1 of 6
A fraud alert on a card
Put it in
What you just did has a name
Streaming vs. batch
Streaming means processing each event as it arrives, like a river.
Batch means collecting events and processing them together on a schedule, like filling a bucket and emptying it once.
Streaming is faster and harder. Batch is cheaper and simpler.
A few more things
Most of the world runs in batches
Bank statements, payroll, report cards, the overnight update to Ashley’s view counts. If the answer can wait until morning, batch is the sane choice.
Streaming is for when waiting costs something
Fraud, live scores, the feed updating while you scroll, a self-driving car deciding what a shape on the road is. When a late answer is a wrong answer, it has to stream.
Same data, both speeds
A tap on a video is streamed to update your feed right now, and also dropped in the pile for the nightly batch that computes Ashley’s analytics. One event, two paths.
Go deeper
The longer version, if you want it.
Why streaming is harder
A batch job sees all the data at once, so it can sort it, count it and double-check it. A streaming system sees one event at a time and has to decide before the next one arrives, with no chance to look ahead. Events also arrive late and out of order, so “how many views in the last minute” is a surprisingly hard question to answer exactly while the minute is still happening.
That’s why real-time numbers on a dashboard are often approximate, and the batch numbers the next morning are the ones people trust.
Quick check
A rideshare app shows your driver’s car moving on the map, and also emails you a monthly ride summary. Which is which?
Let’s take it slower
Ask one question: what happens if the answer shows up tomorrow? If tomorrow is fine, it’s a batch job. Pile the events up, run the math once, done. Cheap. If tomorrow means the money is already gone or the moment already passed, it has to be handled the instant it arrives. That’s streaming. Same events, same math. The only difference is whether you can afford to wait, and waiting is almost always cheaper.
More examples
Voice chat vs. the stats screen
Voice chat in a game has to stream. Every slice of sound is sent the instant it exists, because a half-second delay ruins it. The stats screen at the end of the match is batch: it waited until the match was over and added everything up once.
The electric bill
Your meter records usage all month and the utility totals it once, on a schedule. That’s batch, and it’s why the bill comes monthly instead of by the minute. A smart plug that cuts power the second the meter spikes is the streaming version of the same data.
Back to the question
So why is the fraud alert instant and the recap yearly?
Show the answer
Because a late fraud alert is useless and a late recap is fine. The bank streams every purchase through a model as it happens. The music app waits, piles up a year of plays, and runs one big batch in December.
More on this: What is a database?
One last question
Why would a company bother with batch processing if streaming is faster?
Talk Card
Talk Card · 3.4
Streaming handles each event the moment it arrives, like a fraud alert. Batch piles events up and processes them later, like a year-end recap. Most systems do both.
Data to AI · pettigrewlab.com/learn

