Skip to main content

Streaming vs Batch databases

To understand the difference between Batch and Streaming databases, it’s best to stop thinking about the "database" as just a storage box and start thinking about how it handles time.

The Simple Analogy: The Laundry vs. The Waterfall

  • Batch Processing (The Laundry): You don't wash every sock the second you take it off. You wait until the basket is full (a "batch"), then run a cycle. You get a lot of clean clothes at once, but you have to wait for the cycle to finish to wear any of them.

  • Streaming Processing (The Waterfall): Imagine standing under a waterfall with a cup. You aren't waiting for the river to stop; you are interacting with the water as it moves. You get a drink the instant the water hits your cup.

I will use 2 scenarios to explain these 2 concepts;

Scenario 1: The "Dull" Monthly Report (Batch)

The Setup: A retail chain wants to know their total profit for November.

  • How it works: At the end of the month, the system gathers millions of rows from various stores, "shuts the door," and runs a massive calculation.

  • Why Batch? You don't need to know November's total on November 2nd. You want 100% accuracy and the ability to join complex tables (like "Discounts" + "Returns" + "Sales") without worrying about the data moving while you calculate.

Scenario 2: The "High-Stakes" Fraud Hunter (Streaming)

The Setup: A bank needs to block a credit card if three "suspicious" transactions happen within 30 seconds.

  • How it works: If you use a Batch database, you won't find out about the fraud until the "nightly run"—by then, the money is gone. In a Streaming database, the query is "always on." The moment the 3rd transaction hits the stream, the database triggers an alert.

  • Advanced Concept: Temporal Windows. Streaming databases are experts at "Sliding Windows" (e.g., "Look at the last 10 minutes, updating every second").


Advanced View: "Push" vs. "Pull"

In an advanced architecture, the difference is where the Computation happens:

  • Batch is Pull: The data sits still. You "Pull" an answer out of it by running a query.

  • Streaming is Push: The query sits still. The data "Pushes" through the query, and the result is updated incrementally.

Example: Think of a Google Map.
A Batch approach would be like downloading a static map image every 5 minutes to see where you are. A Streaming approach is the blue dot moving in real-time. The map doesn't re-render the whole world; it just updates your coordinates.

Popular posts from this blog

Programming Without and With AI

👀Programming Without AI refers to traditional software development, where a computer program is designed to perform a specific set of tasks based on explicit rules coded by the programmer. Traditional  programming without AI relies on explicit rules and instructions written by humans. Every possible situation has to be anticipated in advance, and the program follows fixed logic to produce results.  In contrast, programming with AI allows systems to learn from data, adapt to new situations, and improve over time . The image below illustrates the fundamentals of AI, showing how it expands from general Artificial Intelligence into Machine Learning, Neural Networks, and Deep Learning , each adding more advanced capabilities. AI Layers Explained This layered structure highlights how modern AI has moved beyond simple rule-based systems into powerful learning models capable of tasks such as image recognition, natural language processing, and autonomous decision-making.  👀 Bef...

.NET Ecosystem Overview - Roadmap

In this blog series we'll discuss about a roadmap to learn .NET framework. There are 10 stages in this roadmap below I have listed the stages which will guide you when learning this framework; 🌐Introduction to the .NET Framework The .NET Framework is Microsoft’s powerful software development platform, first released in 2002 . Back then, building applications was often messy—developers had to deal with different programming languages, inconsistent APIs, and limited tools. Microsoft’s vision was simple: create a single, unified platform where developers could build desktop apps, web apps, and services using a common foundation. Over the years, .NET has evolved dramatically. It started with the classic .NET Framework , then moved to the open-source and cross-platform .NET Core , and finally merged into today’s modern .NET 5, 6, and beyond , which powers apps on Windows, Linux, macOS, mobile, and even cloud containers. Real-world apps built on .NET include Stack Overflow, Microsof...

How is a CPU Made? Step-by-Step Guide to Microchip Production

Making a CPU, which is the brain of a computer, is a very complex process. It starts with the design. Designers decide how the CPU will work, including how many cores it has and how fast it can process information. Before building it, they use computer programs to test the design and make sure it works correctly. We mainly use silicon as the raw material for the production process. Silicon is a material that comes from sand and can carry electricity when treated in certain ways, as it is a semi conductor . Now  lets dive into the production process of the microchip➡️ 🥇The silicon is purified and shaped into a large cylinder called an ingot . This cylinder is then sliced into very thin discs called wafers, which will become the base for all the CPU circuits. 🥈After that comes photolithography . This is a process where the CPU’s design is printed onto the wafer using light. A special chemical called photoresist is applied to the wafer, which reacts to light. The light makes certain...