<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alege Ahmad Olaitan  on Medium]]></title>
        <description><![CDATA[Stories by Alege Ahmad Olaitan  on Medium]]></description>
        <link>https://medium.com/@alegeahmadolaitan?source=rss-e8049998515c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kt1D4ahg93Bht2qrTPsIYQ.jpeg</url>
            <title>Stories by Alege Ahmad Olaitan  on Medium</title>
            <link>https://medium.com/@alegeahmadolaitan?source=rss-e8049998515c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 20:35:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alegeahmadolaitan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What Actually Happens When Data Streams in Real Time?]]></title>
            <link>https://medium.com/@alegeahmadolaitan/what-actually-happens-when-data-streams-in-real-time-ede450ca7874?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ede450ca7874</guid>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <category><![CDATA[data-transformation]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 11:58:02 GMT</pubDate>
            <atom:updated>2026-09-23T11:58:02.520Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B50ae4chZcoELAEpA28C1g.png" /></figure><p>Most of us interact with streaming data every day without thinking about it.</p><p>You place an order on an e-commerce website. A payment is processed. You receive a notification. The order status changes. Somewhere in the background, data is moving through multiple systems to make all of this possible.</p><p>But what actually happens to that data?</p><p>How does an application turn an action like <strong>“customer placed an order”</strong> into something that can eventually appear on an analytics dashboard?</p><p>This is where <strong>streaming data engineering</strong> comes in.</p><p>In this article, I’ll break down the basic ideas behind streaming data pipelines, why message brokers are used, how data quality fits into the picture, and how streaming and batch processing can work together.</p><p>I’ll also use a small project I built, <strong>Pipelight</strong>, to put some of these concepts into context.</p><h3>What is streaming data?</h3><p>Let’s start with a simple example: imagine an online store.</p><p>Every few seconds, customers might:</p><ul><li>View a product</li><li>Add an item to their cart</li><li>Place an order</li><li>Make a payment</li><li>Cancel an order</li></ul><p>Each of these actions can generate an <strong>event</strong>.</p><p>For example:</p><pre>{<br>  &quot;event_id&quot;: &quot;evt_123&quot;,<br>  &quot;event_type&quot;: &quot;order_completed&quot;,<br>  &quot;customer_id&quot;: &quot;cust_456&quot;,<br>  &quot;order_id&quot;: &quot;ord_789&quot;,<br>  &quot;amount&quot;: 125.50,<br>  &quot;timestamp&quot;: &quot;2026-09-23T10:30:00Z&quot;<br>}</pre><p>Instead of waiting until the end of the day to process these events, a streaming system can begin processing them as they arrive.</p><p>Conceptually:</p><h3>Batch processing</h3><pre>Events<br>   ↓<br>Collect for a period<br>   ↓<br>Process<br>   ↓<br>Store<br>   ↓<br>Analyze</pre><h3>Streaming processing</h3><pre>Event<br>  ↓<br>Process<br>  ↓<br>Store<br>  ↓<br>Analyze<br>  ↓<br>Next event...</pre><p>The important idea is not necessarily that streaming means <strong>instantaneous</strong> processing.</p><p>It means that data is processed continuously as it becomes available rather than waiting for a large batch to accumulate.</p><h3>Why not just send data directly to the database?</h3><p>You might be wondering:</p><blockquote><em>If an application generates an event, why not just write it directly into PostgreSQL?</em></blockquote><p>Sometimes you can.</p><p>But as systems grow, this approach can become problematic.</p><p>Imagine thousands of applications generating events simultaneously.</p><p>You don’t necessarily want every application directly communicating with every downstream system.</p><p>Instead, you can introduce a <strong>message broker</strong>.</p><pre>Applications<br>     ↓<br>Message Broker<br>     ↓<br>Consumers<br>     ↓<br>Databases / Analytics / Other Systems</pre><p>The broker acts as a buffer and communication layer between producers and consumers. This creates some useful separation.</p><p>The application producing an event doesn’t necessarily need to know which downstream systems will eventually consume it.</p><h3>Enter Kafka — and Kafka-compatible systems</h3><p>One of the most well-known technologies for event streaming is <strong>Apache Kafka</strong>.</p><p>Kafka provides the infrastructure for applications to publish and consume streams of events. At a high level, you have:</p><h3>Producers</h3><p>Applications that generate events.</p><pre>Application<br>     ↓<br>Producer<br>     ↓<br>Kafka topic</pre><h3>Topics</h3><p>A topic is a named stream of events.</p><p>For example:</p><pre>orders<br>payments<br>user_activity</pre><p>An application could publish order events to the orders topic.</p><h3>Consumers</h3><p>Applications that read events from topics.</p><pre>Kafka topic<br>     ↓<br>Consumer<br>     ↓<br>Processing</pre><p>Multiple consumers can consume the same stream for different purposes.</p><p>For example:</p><pre>                 ┌──→ Analytics<br>                 │<br>orders topic ────┼──→ Fraud detection<br>                 │<br>                 └──→ Notifications</pre><p>This is one of the reasons event-driven architectures can be powerful.</p><p>The system producing an event doesn’t necessarily have to know everything that will happen to that event afterward.</p><h3>Streaming isn’t just about speed</h3><p>When people hear “real-time data,” the first thing they often think about is speed. But speed is only part of the problem; the harder question is:</p><blockquote><strong><em>What happens when the data is wrong?</em></strong></blockquote><p>Real-world data is messy, you might receive:</p><ul><li>Malformed events</li><li>Missing fields</li><li>Duplicate events</li><li>Events arriving late</li><li>Unexpected event types</li><li>Failed transactions</li><li>Sudden traffic spikes</li></ul><p>For example, suppose your pipeline expects:</p><pre>{<br>  &quot;event_id&quot;: &quot;123&quot;,<br>  &quot;event_type&quot;: &quot;order_completed&quot;,<br>  &quot;amount&quot;: 50.00<br>}</pre><p>But instead receives:</p><pre>{<br>  &quot;event_id&quot;: &quot;123&quot;,<br>  &quot;event_type&quot;: &quot;order_completed&quot;,<br>  &quot;amount&quot;: &quot;unknown&quot;<br>}</pre><p>If your pipeline blindly accepts everything, you could end up contaminating your analytical data.</p><p>This is why <strong>data quality needs to be part of the pipeline itself</strong>.</p><h3>Validating events before they enter the data layer</h3><p>A common pattern is to validate events before treating them as trusted data.</p><p>Conceptually:</p><pre>                  ┌──→ Valid events ──→ Database<br>                  │<br>Incoming events ──┤<br>                  │<br>                  └──→ Invalid events</pre><p>The invalid events don’t necessarily need to be thrown away.</p><p>Instead, they can be isolated for investigation.</p><p>For example:</p><pre>Redpanda<br>   ↓<br>Consumer<br>   ↓<br>Validation<br>   ├──→ Valid → PostgreSQL<br>   │<br>   └──→ Invalid → Quarantine</pre><p>This is a small architectural decision, but it has a significant consequence:</p><p><strong>Your analytics system can distinguish between trusted data and data that needs investigation.</strong></p><h3>What about duplicate events?</h3><p>Duplicates are another common problem in event-driven systems.</p><p>Imagine a customer places an order.</p><p>The application sends:</p><pre>order_completed</pre><p>But because of a network retry, the same event gets sent again.</p><p>Now the consumer sees:</p><pre>evt_123<br>evt_123</pre><p>If you simply insert both records, you might count the order twice.</p><p>This is why streaming systems often need concepts such as:</p><ul><li>Event IDs</li><li>Idempotency</li><li>Deduplication</li><li>Delivery semantics</li></ul><p>The exact implementation depends on the system, but the principle is simple:</p><blockquote><strong><em>Receiving an event more than once shouldn’t necessarily mean processing the business action more than once.</em></strong></blockquote><h3>What about events that arrive late?</h3><p>Time creates another interesting problem.</p><p>Suppose an order actually happened at:</p><pre>10:00:00</pre><p>But due to a network problem, your system doesn’t receive it until:</p><pre>10:05:00</pre><p>Which time should your analytics use?</p><p>The time the event happened?</p><p>Or the time your system received it?</p><p>This distinction becomes important when building:</p><ul><li>Time-based aggregations</li><li>Revenue reports</li><li>Monitoring systems</li><li>Fraud detection</li><li>Operational dashboards</li></ul><p>Streaming systems therefore often need to distinguish between <strong>event time</strong> and <strong>processing time</strong>.</p><h4>Event time</h4><p>When the event actually happened.</p><h4>Processing time</h4><p>When your system processed the event.</p><p>They aren’t always the same.</p><h3>Streaming and batch aren’t enemies</h3><p>Another misconception is that once you introduce streaming, everything has to become streaming.</p><p>It doesn’t, a real data platform can combine both approaches.</p><p>For example:</p><pre>                Streaming<br>                    ↓<br>Application → Message Broker → Raw Data<br>                                  ↓<br>                                Batch<br>                                  ↓<br>                                dbt<br>                                  ↓<br>                           Analytics Models<br>                                  ↓<br>                              Dashboard</pre><p>The ingestion layer can continuously capture events while analytical transformations run periodically.</p><p>This is often perfectly reasonable.</p><p>For example, you might want:</p><ul><li>Events captured continuously</li><li>Data quality checks running continuously</li><li>Analytical models refreshed every 15 minutes</li><li>Daily financial reconciliation performed once per day</li></ul><p>Different workloads can have different processing requirements.</p><p>The goal isn’t to make everything “real time.”</p><p>The goal is to choose an architecture appropriate for the problem.</p><h3>Where does dbt fit?</h3><p>This is where things become particularly interesting for data engineers.</p><p>A streaming pipeline can still have a familiar analytical transformation layer.</p><p>For example:</p><pre>Raw Events<br>    ↓<br>PostgreSQL<br>    ↓<br>dbt<br>    ↓<br>Analytics Models</pre><p>You might start with raw event data:</p><pre>raw_events</pre><p>and transform it into models such as:</p><pre>fct_orders<br>agg_events_daily<br>agg_revenue_daily</pre><p>The raw layer preserves what actually arrived.</p><p>The analytical layer gives downstream users cleaner, business-oriented datasets.</p><p>This separation is useful because raw ingestion and analytical modelling have different responsibilities.</p><h3>And where does Airflow fit?</h3><p>If you’re already familiar with Airflow, you might ask:</p><blockquote><em>If the pipeline is streaming, why do I need Airflow?</em></blockquote><p>Because not every part of a data platform needs to run continuously.</p><p>For example, the ingestion layer might continuously consume events:</p><pre>Application<br>    ↓<br>Redpanda<br>    ↓<br>Consumer<br>    ↓<br>PostgreSQL</pre><p>While Airflow can orchestrate downstream transformations:</p><pre>PostgreSQL<br>    ↓<br>Airflow<br>    ↓<br>   dbt<br>    ↓<br>Analytics Models</pre><p>Airflow isn’t necessarily responsible for the event streaming itself. It can instead coordinate the workflows that happen around the streaming system.</p><p>This is an important distinction:</p><blockquote><strong><em>Streaming infrastructure and workflow orchestration solve different problems.</em></strong></blockquote><h3>Putting the pieces together</h3><p>At this point, we can build a simplified streaming architecture:</p><pre>                 ┌─────────────────┐<br>                 │    Application  │<br>                 └────────┬────────┘<br>                          │<br>                          ▼<br>                 ┌─────────────────┐<br>                 │    Redpanda     │<br>                 │ Message Broker  │<br>                 └────────┬────────┘<br>                          │<br>                          ▼<br>                 ┌─────────────────┐<br>                 │   Consumer  +   │<br>                 │   Validation    │<br>                 └────────┬────────┘<br>                          │<br>                    ┌─────┴─────┐<br>                    │           │<br>                    ▼           ▼<br>                 Valid        Invalid<br>                    │           │<br>                    ▼           ▼<br>                Database    Quarantine<br>                    │<br>                    ▼<br>                 dbt models<br>                    │<br>                    ▼<br>              Analytics Layer<br>                    │<br>                    ▼<br>                Dashboard</pre><p>This is the basic architecture I wanted to explore in practice.</p><h3>Building Pipelight</h3><p>To move beyond diagrams and theory, I built <strong>Pipelight</strong>.</p><p>Pipelight is a small event-driven analytics platform that simulates an e-commerce environment and lets you observe how events move through a streaming data pipeline.</p><p>The architecture looks roughly like this:</p><pre>                   Storefront<br>                       │<br>                       ▼<br>                    FastAPI<br>                       │<br>                       ▼<br>                   Redpanda<br>                       │<br>                       ▼<br>                Event Consumer<br>                       │<br>                 Validation<br>                  /       \<br>                 /         \<br>              Valid       Invalid<br>                │            │<br>                ▼            ▼<br>           PostgreSQL     Quarantine<br>                │<br>                ▼<br>               dbt<br>                │<br>                ▼<br>        Analytics Marts<br>                │<br>                ▼<br>        Metrics / Grafana</pre><p>The project includes scenarios designed to simulate some of the problems a streaming pipeline can encounter:</p><ul><li>Traffic spikes</li><li>Invalid schemas</li><li>Duplicate events</li><li>Late-arriving events</li><li>Payment failures</li></ul><p>The goal was to create something small enough to understand streaming end-to-end while still dealing with problems that actually matter in data engineering.</p><h3>What building it reinforced for me</h3><p>One of the biggest things I took away is that <strong>streaming isn’t simply “using Kafka.”</strong></p><p>A streaming data platform involves several different concerns:</p><h4>1. Ingestion</h4><p>How do events enter the system?</p><h4>2. Transport</h4><p>How do events move reliably between producers and consumers?</p><h4>3. Validation</h4><p>How do we determine whether an event is usable?</p><h4>4. Storage</h4><p>Where do we keep the data?</p><h4>5. Transformation</h4><p>How do raw events become useful analytical datasets?</p><h4>6. Orchestration</h4><p>How do we coordinate workflows that don’t need to run continuously?</p><h4>7. Observability</h4><p>How do we know whether the pipeline is healthy?</p><h4>8. Data correctness</h4><p>How do we deal with duplicates, late events and malformed data?</p><p>Thinking about all of these together is what turns a collection of technologies into a <strong>data platform.</strong></p><h3>The bigger picture</h3><p>A streaming pipeline might look complicated when you see all of its components:</p><pre>Kafka (Redpanda)<br>PostgreSQL<br>Airflow<br>dbt<br>Python<br>Grafana<br>APIs<br>Validation<br>Monitoring</pre><p>But each component is solving a different problem.</p><p>The important part isn’t memorizing the tools. It’s understanding <strong>why each piece exists</strong> and how they work together.</p><p>That’s also why I think building projects is particularly useful when learning data engineering. You can read about Kafka partitions, event time, idempotency and data quality for hours.</p><p>But when you deliberately introduce duplicate events into your own pipeline and watch your revenue metric change, the concept becomes much easier to understand.</p><h3>Final thoughts</h3><p>Streaming data engineering is ultimately about designing systems that can continuously handle events while remaining reliable, observable and useful.</p><p>The interesting part isn’t simply getting an event from point A to point B. It’s everything that happens when reality gets involved.</p><p>What if the event is invalid? What if it arrives late? What if it arrives twice What if traffic suddenly increases? What if a downstream system fails? Or what if the data needs to be transformed into something a business user can actually understand?</p><p>These questions are where streaming becomes more than just “real-time data.”</p><p>They are the engineering problems that make the field interesting.</p><h3>Try it yourself</h3><p>I built <strong>Pipelight</strong> as a practical way to explore these concepts and make the entire flow visible.</p><p>If you’re learning data engineering or want to experiment with streaming systems, you can explore the project here:</p><p><strong>GitHub:</strong> <a href="https://github.com/ahmadalege/Pipelight">https://github.com/ahmadalege/Pipelight</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ede450ca7874" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dimensional Modelling vs Data Vault vs One Big Table]]></title>
            <link>https://medium.com/@alegeahmadolaitan/dimensional-modelling-vs-data-vault-vs-one-big-table-e42fc310fef4?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e42fc310fef4</guid>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[data-modelling]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Thu, 07 May 2026 11:06:01 GMT</pubDate>
            <atom:updated>2026-05-07T11:06:01.229Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Three philosophies. One warehouse. The question isn’t which one is best; it’s which one is right for you.</em></p><p>At some point in every data engineer’s career, someone in a meeting says, <em>“Should we just put everything in one big table?”</em> Half the room nods. The other half visibly winces. And everyone realises they’re about to have a conversation that will last much longer than it should.</p><p>The three dominant approaches to structuring a data warehouse: Dimensional Modelling, Data Vault, and One Big Table, represent genuinely different philosophies about what a warehouse is <em>for</em>. Understanding them properly means you can choose deliberately, defend your decision in a design review, and know when to change course.</p><blockquote><em>INTERVIEW QUESTION</em></blockquote><blockquote>Walk me through the different data modelling approaches you’ve worked with. How do you decide which one to use?</blockquote><p>Before diving in, a quick map of the territory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*kNwY_Nj4v9GtzN28ZZgmZQ.png" /></figure><h3>1. Dimensional Modelling (Star Schema)</h3><p>Introduced by Ralph Kimball in the 1990s, dimensional modelling is the most widely taught and widely used approach in analytical warehousing. The idea is simple: you have fact tables (measurements, events, transactions) and dimension tables (the context: who, what, where, when).</p><p>The result is a <em>star schema. </em>fact table at the centre, dimensions radiating outward. It’s intuitive, BI-tool friendly, and performs well for most analytical queries.</p><p>A variation of this design is the <em>snowflake schema</em>, where dimension tables are further normalized into multiple related tables, reducing redundancy but often making queries more complex.</p><h4>The Setup</h4><pre>-- Dimension: Customers<br>CREATE TABLE dim_customer (<br>    customer_key  INT  PRIMARY KEY,   -- surrogate key<br>    customer_id   INT,               -- business key<br>    first_name    VARCHAR(50),<br>    last_name     VARCHAR(50),<br>    city          VARCHAR(80),<br>    loyalty_tier  VARCHAR(20)<br>);<br><br>-- Dimension: Date (always worth building properly)<br>CREATE TABLE dim_date (<br>    date_key      INT  PRIMARY KEY,   -- e.g. 20240115<br>    full_date     DATE,<br>    day_of_week   VARCHAR(10),<br>    month_name    VARCHAR(10),<br>    quarter       INT,<br>    year          INT,<br>    is_weekend    BOOLEAN<br>);<br><br>-- Fact: Sales<br>CREATE TABLE fact_sales (<br>    sale_id       INT  PRIMARY KEY,<br>    customer_key  INT  REFERENCES dim_customer(customer_key),<br>    date_key      INT  REFERENCES dim_date(date_key),<br>    amount        DECIMAL(10,2),<br>    quantity      INT<br>);</pre><h4>Querying It</h4><p>The star schema shines here; queries are readable, fast, and map directly to business questions:</p><pre>SELECT<br>    d.year,<br>    d.quarter,<br>    c.loyalty_tier,<br>    SUM(f.amount)   AS total_revenue,<br>    COUNT(f.sale_id) AS total_sales<br>FROM      fact_sales    f<br>JOIN      dim_customer  c  ON c.customer_key = f.customer_key<br>JOIN      dim_date      d  ON d.date_key     = f.date_key<br>GROUP BY  d.year, d.quarter, c.loyalty_tier<br>ORDER BY  d.year, d.quarter;</pre><p><strong>✓ Best for</strong>: BI reporting, dashboards, analyst self-service, teams with stable, well-understood business domains.</p><p><strong>✗ Watch out for</strong>: Schema changes are painful, and adding a new dimension or attribute requires migrations. Not well-suited to rapidly evolving source systems.</p><h3>2. Data Vault</h3><p>Dan Linstedt developed Data Vault in the early 2000s as a response to the rigidity of dimensional modelling. It’s designed for enterprises dealing with many source systems, strict audit requirements, and constantly changing business rules.</p><p>The model has three building blocks: Hubs (business keys), Links (relationships between hubs), and Satellites (descriptive attributes, with full history). Business logic lives in the reporting layer. The vault itself is a raw, auditable store of what arrived and when.</p><h4>The Setup</h4><pre>-- Hub: the business key for customers<br>CREATE TABLE hub_customer (<br>    customer_hk    CHAR(32)    PRIMARY KEY,  -- MD5 hash of business key<br>    customer_id    INT         NOT NULL,     -- business key<br>    load_date      TIMESTAMP   NOT NULL,<br>    record_source  VARCHAR(100) NOT NULL      -- e.g. &#39;CRM_SYSTEM&#39;<br>);<br><br>-- Hub: the business key for products<br>CREATE TABLE hub_product (<br>    product_hk     CHAR(32)    PRIMARY KEY,<br>    product_id     INT         NOT NULL,<br>    load_date      TIMESTAMP   NOT NULL,<br>    record_source  VARCHAR(100) NOT NULL<br>);<br><br>-- Link: the relationship between customer and product (a sale)<br>CREATE TABLE link_sale (<br>    sale_hk        CHAR(32)    PRIMARY KEY,<br>    customer_hk    CHAR(32)    REFERENCES hub_customer(customer_hk),<br>    product_hk     CHAR(32)    REFERENCES hub_product(product_hk),<br>    load_date      TIMESTAMP   NOT NULL,<br>    record_source  VARCHAR(100) NOT NULL<br>);<br><br>-- Satellite: descriptive attributes of a customer, with history<br>CREATE TABLE sat_customer_details (<br>    customer_hk    CHAR(32)    REFERENCES hub_customer(customer_hk),<br>    load_date      TIMESTAMP   NOT NULL,<br>    load_end_date  TIMESTAMP,<br>    record_source  VARCHAR(100),<br>    first_name     VARCHAR(50),<br>    last_name      VARCHAR(50),<br>    city           VARCHAR(80),<br>    loyalty_tier   VARCHAR(20),<br>    PRIMARY KEY   (customer_hk, load_date)<br>);</pre><h4>Querying It</h4><p>You don’t query the vault directly for reports, you build <em>Information Marts</em> on top of it, which look like dimensional models. The vault is the integration layer; the mart is the consumption layer.</p><pre>-- Information Mart: current customer view (for BI / reporting)<br>CREATE VIEW mart_current_customers AS<br>SELECT<br>    h.customer_id,<br>    s.first_name,<br>    s.last_name,<br>    s.city,<br>    s.loyalty_tier,<br>    s.load_date   AS effective_from<br>FROM      hub_customer         h<br>JOIN      sat_customer_details s<br>       ON s.customer_hk = h.customer_hk<br>WHERE     s.load_end_date IS NULL;  -- current record only</pre><p><strong>✓ Best for</strong>: Enterprise environments, regulatory compliance, many source systems, frequent schema changes, and anywhere you need a full audit trail of every data load.</p><p><strong>✗ Watch out for</strong>: High complexity, steep learning curve, verbose SQL, and significant overhead for small teams. If you don’t need the auditability, it’s probably over-engineering.</p><h3>3. One Big Table (OBT)</h3><p>One Big Table is exactly what it sounds like. Every fact and every relevant dimension attribute gets pre-joined and denormalised into a single wide table. No joins at query time. Analysts just SELECT what they need.</p><p>This pattern got a major revival with the rise of cloud warehouses like BigQuery and Snowflake, where storage is cheap and columnar engines handle wide tables efficiently. Tools like dbt made it easy to build and maintain these wide models as transformations</p><h4>The Setup</h4><pre>CREATE TABLE obt_sales AS<br>SELECT<br>    -- fact columns<br>    f.sale_id,<br>    f.amount,<br>    f.quantity,<br><br>    -- customer attributes (denormalised in)<br>    c.customer_id,<br>    c.first_name,<br>    c.last_name,<br>    c.city,<br>    c.loyalty_tier,<br><br>    -- date attributes (denormalised in)<br>    d.full_date     AS sale_date,<br>    d.day_of_week,<br>    d.month_name,<br>    d.quarter,<br>    d.year,<br>    d.is_weekend,<br><br>    -- derived metrics (computed once, reused freely)<br>    f.amount * 0.15   AS estimated_tax,<br>    f.amount / NULLIF(f.quantity, 0) AS avg_unit_price<br><br>FROM  fact_sales   f<br>JOIN  dim_customer c ON c.customer_key = f.customer_key<br>JOIN  dim_date     d ON d.date_key     = f.date_key;</pre><h4>Querying It</h4><p>This is the entire point, analysts never need to think about joins.</p><pre>-- Same business question as before — zero joins<br>SELECT<br>    year,<br>    quarter,<br>    loyalty_tier,<br>    SUM(amount)    AS total_revenue,<br>    COUNT(sale_id) AS total_sales<br>FROM     obt_sales<br>GROUP BY year, quarter, loyalty_tier<br>ORDER BY year, quarter;</pre><p><strong>✓ Best for</strong>: Small-to-medium teams, fast iteration, analyst self-service, modern cloud warehouses where storage cost is negligible.</p><p><strong>✗ Watch out for: </strong>Data duplication, consistency risk (same metric calculated differently in two places), and tables that become unmaintainable as they grow to 200+ columns</p><blockquote>OBT isn’t lazy modelling — it’s a deliberate trade-off. The question is whether you’re making it consciously or by accident.</blockquote><h3>Head-to-Head Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*VkF5drezFvDLFfPwBNbEAQ.png" /></figure><h3>How to Choose</h3><p>In practice, most production warehouses don’t pick just one. A common pattern in mature stacks:</p><h4><strong>If you need:</strong></h4><ul><li>Full audit trails, many source systems, regulatory compliance → Data Vault as integration layer + Dimensional marts on top</li><li>Stable reporting, well-defined business domains, BI self-service → Dimensional modelling (star schema)</li><li>Fast analyst access, small team, modern cloud warehouse, quick iteration → One Big Table, with clear ownership of metrics</li></ul><p><em>The honest answer to the interview question isn’t “I always use X.” It’s: “I understand the trade-offs, and I pick based on team size, scale, how often the schema changes, and what the analysts actually need to do.” That’s the answer that earns the follow-up conversation and the one that reflects how good warehouse design actually works.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e42fc310fef4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What data quality checks do you implement to ensure accuracy, freshness, and completeness?]]></title>
            <link>https://medium.com/@alegeahmadolaitan/what-data-quality-checks-do-you-implement-to-ensure-accuracy-freshness-and-completeness-6635eb82dcf5?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6635eb82dcf5</guid>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 10:11:01 GMT</pubDate>
            <atom:updated>2026-04-30T10:11:01.270Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The question sounds simple. Most answers aren’t good enough. Here’s how to actually answer it, and more importantly, how to actually do it.</em></p><p>If you’ve interviewed for a data engineering or analytics role in the last few years, you’ve almost certainly been asked some version of this question. It’s deceptively open-ended; the interviewer isn’t just checking if you know what a NULL is. They want to know if you&#39;ve felt the pain of bad data in production and built something to stop it from happening again.</p><p>This article is structured as a real answer you could give but with enough depth that it also serves as a practical reference. Let’s dive in.</p><blockquote><strong><em>INTERVIEW QUESTION</em></strong></blockquote><blockquote>“Walk me through the data quality checks you implement in your pipelines. How do you make sure data is accurate, fresh, and complete?”</blockquote><p>A strong answer touches three distinct dimensions. Most candidates conflate them or only cover one well. The framing I always use is:</p><blockquote><strong><em>Accuracy</em></strong></blockquote><blockquote>Is the data actually correct? Does it reflect reality — valid values, consistent formats, no constraint violations</blockquote><blockquote><strong><em>Freshness</em></strong></blockquote><blockquote>Is the data current? Did the pipeline actually run? When was the last record loaded — and is that acceptable?</blockquote><blockquote><strong><em>Completeness</em></strong></blockquote><blockquote>Is all the data there? No missing rows, no silent drops, no columns riddled with NULLs that shouldn’t be.</blockquote><h3>1. ACCURACY CHECKS</h3><p>Accuracy is about <strong>validity</strong>. The data arrived, it loaded but is it right? This is where most pipelines have the most silent failures, becuase bad values don’t throw errors. They quietly poison your reports.</p><h4><strong>Referential Integrity</strong></h4><p>The first thing I check: does every foreign key actually point to something? Orphaned records are common when upstream systems delete without cascading.</p><pre>-- Find sales with no matching customer<br>SELECT s.sale_id, s.customer_id<br>FROM   sales s<br>LEFT JOIN customers c ON c.customer_id = s.customer_id<br>WHERE  c.customer_id IS NULL;<br><br>-- Zero rows = pass. Any rows = pipeline alert.</pre><h4>Domain / Range Validation</h4><p>Check that values fall within expected ranges. A transaction amount of -99999 might be valid SQL but it&#39;s almost certainly a bug.</p><pre>-- Negative amounts (shouldn&#39;t exist for sales)<br>SELECT COUNT(*) AS negative_sales<br>FROM   sales<br>WHERE  amount &lt; 0;<br><br>-- Invalid loyalty tier values<br>SELECT COUNT(*) AS bad_tiers<br>FROM   customers<br>WHERE  loyalty_tier NOT IN (&#39;Bronze&#39;, &#39;Silver&#39;, &#39;Gold&#39;)<br>   OR  loyalty_tier IS NULL;<br><br>-- Future-dated records (data entry error / timezone bug)<br>SELECT COUNT(*) AS future_sales<br>FROM   sales<br>WHERE  sale_date &gt; CURRENT_DATE;</pre><h4>Duplicate Detection</h4><p>Duplicates are the most common accuracy issue I’ve seen in production, usually from a pipeline retry or a botched upsert. Always check for them explicitly, especially after a load.</p><pre>-- Find duplicate sale IDs (should be zero)<br>SELECT   sale_id, COUNT(*) AS occurrences<br>FROM     sales<br>GROUP BY sale_id<br>HAVING   COUNT(*) &gt; 1;<br><br>-- Fuzzy duplicate check: same customer, same amount, same day<br>SELECT   customer_id, sale_date, amount, COUNT(*) AS dupes<br>FROM     sales<br>GROUP BY customer_id, sale_date, amount<br>HAVING   COUNT(*) &gt; 1;</pre><h3>2. FRESHNESS CHECKS</h3><p>Freshness is the most underrated dimension. Your data can be perfectly accurate and complete yet, completely stale. A dashboard showing last month’s numbers as “live” is arguably worse than one that’s obviously broken, because stakeholders <em>trust</em> it.</p><blockquote>The most dangerous data quality issue is the one that looks fine on the surface.</blockquote><h4>Last Load Timestamp Check</h4><p>Every table your pipeline touches should have a loaded_at or updated_at column. If it doesn&#39;t, add one. Then check it.</p><pre>-- How long since the last record was loaded?<br>SELECT<br>    MAX(loaded_at)                            AS last_load,<br>    CURRENT_TIMESTAMP - MAX(loaded_at)        AS age,<br>    CASE<br>        WHEN MAX(loaded_at) &lt; CURRENT_TIMESTAMP - INTERVAL &#39;1 hour&#39;<br>        THEN &#39;STALE ⚠&#39;<br>        ELSE &#39;FRESH ✓&#39;<br>    END                                        AS status<br>FROM sales;<br><br>-- For tables without loaded_at, use the latest business date<br>SELECT<br>    MAX(sale_date)  AS latest_sale_date,<br>    CURRENT_DATE - MAX(sale_date) AS days_behind<br>FROM sales;</pre><h4>Row Arrival Rate</h4><p>Beyond “did data arrive”, check that it arrived at a <em>reasonable volume</em>. A pipeline that loaded 3 rows when it normally loads 50,000 has a problem even if those 3 rows are perfectly valid.</p><pre>-- Daily row counts for the last 14 days<br>SELECT<br>    sale_date,<br>    COUNT(*)                        AS daily_rows,<br>    AVG(COUNT(*)) OVER (<br>        ORDER BY sale_date<br>        ROWS BETWEEN 6 PRECEDING AND CURRENT ROW<br>    )                               AS rolling_7d_avg<br>FROM   sales<br>WHERE  sale_date &gt;= CURRENT_DATE - INTERVAL &#39;14 days&#39;<br>GROUP BY sale_date<br>ORDER BY sale_date DESC;<br><br>-- Flag today if volume is &lt; 50% of 7-day average<br>WITH daily AS (<br>    SELECT<br>        sale_date,<br>        COUNT(*) AS cnt,<br>        AVG(COUNT(*)) OVER (<br>            ORDER BY sale_date<br>            ROWS BETWEEN 6 PRECEDING AND CURRENT ROW<br>        ) AS avg_7d<br>    FROM   sales<br>    GROUP BY sale_date<br>)<br>SELECT sale_date, cnt, avg_7d,<br>    CASE WHEN cnt &lt; avg_7d * 0.5 THEN &#39;LOW VOLUME ⚠&#39; ELSE &#39;OK&#39; END AS flag<br>FROM  daily<br>ORDER BY sale_date DESC;</pre><h3>3. COMPLETENESS CHECKS</h3><p>Completeness asks: <em>is everything that should be here, actually here?</em> This covers NULL rates, missing expected records, and coverage gaps across key dimensions.</p><h4>NULL Rate Profiling</h4><p>Run NULL profiling on every column of any table that feeds a critical report. Some NULLs are expected, others are a sign something upstream broke silently.</p><pre>-- NULL rate per column (customers table)<br>SELECT<br>    COUNT(*) AS total_rows,<br><br>    ROUND(100.0 * SUM(CASE WHEN first_name   IS NULL THEN 1 ELSE 0 END) / COUNT(*), 2) AS pct_null_first_name,<br>    ROUND(100.0 * SUM(CASE WHEN last_name    IS NULL THEN 1 ELSE 0 END) / COUNT(*), 2) AS pct_null_last_name,<br>    ROUND(100.0 * SUM(CASE WHEN city         IS NULL THEN 1 ELSE 0 END) / COUNT(*), 2) AS pct_null_city,<br>    ROUND(100.0 * SUM(CASE WHEN loyalty_tier IS NULL THEN 1 ELSE 0 END) / COUNT(*), 2) AS pct_null_tier,<br>    ROUND(100.0 * SUM(CASE WHEN email        IS NULL THEN 1 ELSE 0 END) / COUNT(*), 2) AS pct_null_email<br><br>FROM customers;</pre><h4>Expected Population Checks</h4><p>If you expect data for every active customer every day, check for gaps. A missing partition or a silent filter somewhere upstream won’t announce itself.</p><pre>-- Customers who have NEVER had a sale (expected or unexpected?)<br>SELECT c.customer_id, c.first_name, c.last_name<br>FROM      customers c<br>LEFT JOIN sales     s ON s.customer_id = c.customer_id<br>WHERE     s.sale_id IS NULL;<br><br>-- Date spine check: missing days in sales data<br>WITH date_spine AS (<br>    -- generate every date in the expected range<br>    SELECT CURRENT_DATE - (n * INTERVAL &#39;1 day&#39;) AS dt<br>    FROM   GENERATE_SERIES(0, 29) n   -- last 30 days<br>),<br>actual AS (<br>    SELECT DISTINCT sale_date FROM sales<br>)<br>SELECT d.dt AS missing_date<br>FROM      date_spine d<br>LEFT JOIN actual     a ON a.sale_date = d.dt<br>WHERE     a.sale_date IS NULL<br>ORDER BY  d.dt;</pre><h4>Row Count Reconciliation</h4><p>When moving data between systems — staging → warehouse, source → target, always reconcile counts. If the source had 100,000 rows and your target has 98,400, something was dropped and you need to know why.</p><pre>-- Compare row counts and sum totals between staging and final table<br>SELECT<br>    &#39;staging&#39;           AS layer,<br>    COUNT(*)            AS row_count,<br>    SUM(amount)         AS total_amount<br>FROM sales_staging<br><br>UNION ALL<br><br>SELECT<br>    &#39;production&#39;        AS layer,<br>    COUNT(*)            AS row_count,<br>    SUM(amount)         AS total_amount<br>FROM sales;<br><br>-- row_count and total_amount should match exactly</pre><h3>IN PRODUCTION</h3><p>Running these queries manually is fine for a one-off audit. In production, you need them automated, alerting, and tracked over time. A few approaches worth knowing are in the table below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*WFQ4GdRKeKPM7R8jdNJGPg.png" /></figure><p>The most common recommendation for most teams: start with dbt tests for structural checks (NULLs, uniqueness, referential integrity) and a simple SQL-based freshness check logged to a monitoring table. Add Great Expectations or Soda when you need custom business-rule validation that doesn’t fit cleanly into dbt’s model.</p><h3>So, how to actually answer this in an interview?</h3><p>Structure your answer around the three dimensions: accuracy, freshness, and completeness. Give one concrete example of a check you’ve implemented for each. Mention what happened when a check <em>failed</em> and what you did about it. That’s the answer that lands. Anyone can list check types. The candidate who remembers the time a pipeline silently dropped 40% of rows for three days and built something to catch it is the one who gets hired.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6635eb82dcf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Slowly Changing Dimensions:
The Complete Practitioner’s Guide]]></title>
            <link>https://medium.com/@alegeahmadolaitan/slowly-changing-dimensions-the-complete-practitioners-guide-d6128655d2f6?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6128655d2f6</guid>
            <category><![CDATA[slowly-changing-dimension]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <category><![CDATA[scd]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[scd-type-2]]></category>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Wed, 22 Apr 2026 14:02:26 GMT</pubDate>
            <atom:updated>2026-04-22T14:02:26.889Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Everything you need to know about SCD Types 0–6 — with a real database, working SQL, and the trade-offs that actually matter at scale.</em></p><p>Imagine your company’s top customer, Sarah Bioye, gets married and changes her last name. She also moves from Lagos to London and gets promoted from <em>Silver</em> to <em>Gold</em> tier. Simple enough to update in your CRM; but what happens to last year’s revenue reports that credited “Sarah Bioye, Lagos, Silver”?</p><p>That tension between current truth and historical accuracy is exactly what Slowly Changing Dimensions (SCD) solve. They are the foundational design patterns of every serious data warehouse.</p><blockquote><em>“</em>A dimension is ‘slowly changing’ because it changes infrequently, but it does change — and how you handle that change defines the fidelity of every report built on top of it.<em>”</em></blockquote><h4>SAMPLE DATABASE</h4><p>We’ll use a simple customers dimension and a sales fact table throughout. Run this to create and populate your playground:</p><pre>-- ─────────────────────────────────────────────<br>-- Core tables (works in PostgreSQL, MySQL 8+,<br>-- SQL Server, Snowflake, BigQuery std SQL)<br>-- ─────────────────────────────────────────────<br><br>CREATE TABLE customers (<br>    customer_id   INT          PRIMARY KEY,<br>    first_name    VARCHAR(50),<br>    last_name     VARCHAR(50),<br>    city          VARCHAR(80),<br>    loyalty_tier  VARCHAR(20),   -- &#39;Bronze&#39; | &#39;Silver&#39; | &#39;Gold&#39;<br>    email         VARCHAR(120)<br>);<br><br>CREATE TABLE sales (<br>    sale_id     INT  PRIMARY KEY,<br>    customer_id INT  REFERENCES customers(customer_id),<br>    sale_date   DATE,<br>    amount      DECIMAL(10,2)<br>);<br><br>-- Seed customers<br>INSERT INTO customers VALUES<br>  (1, &#39;Sarah&#39;, &#39;Bioye&#39;,   &#39;Lagos&#39;,  &#39;Silver&#39;, &#39;sarah@email.com&#39;),<br>  (2, &#39;Emeka&#39;, &#39;Obi&#39;,    &#39;Abuja&#39;,  &#39;Bronze&#39;, &#39;emeka@email.com&#39;),<br>  (3, &#39;Priya&#39;, &#39;Sharma&#39;, &#39;Mumbai&#39;, &#39;Gold&#39;,   &#39;priya@email.com&#39;);<br><br>-- Seed historical sales<br>INSERT INTO sales VALUES<br>  (101, 1, &#39;2023-03-15&#39;, 450.00),<br>  (102, 2, &#39;2023-06-22&#39;, 120.00),<br>  (103, 1, &#39;2024-01-10&#39;, 980.00),<br>  (104, 3, &#39;2024-07-04&#39;, 2100.00);</pre><p>Now Sarah gets married and upgrades her tier. Let’s see how each SCD type handles this.</p><h4>SCD TYPES</h4><p>Ralph Kimball defined the core SCD types in the 90s. They are:</p><ol><li>Type 0</li><li>Type 1</li><li>Type 2</li><li>Type 3</li><li>Type 4</li><li>Type 6</li></ol><p>Let’s go through types 1 to 3 as they are the most commonly used.</p><h4>Type 0 — The Immutable Record</h4><p>Some attributes should <em>never</em> change: a customer’s original sign-up date, a product’s launch SKU, a contract’s creation timestamp. Type 0 means you simply don’t update. The power is in the discipline of not touching the column.</p><p><strong>Best for</strong>: Audit fields, original registration data, immutable identifiers.</p><h4>Type 1 — Overwrite</h4><p>The simplest pattern. When Sarah changes her name, you update the row. History is gone. Your reports will always show “Sarah Adeyemi” — even for a sale made in 2023 when she was still “Bioye”.</p><pre>-- Sarah Bioye married → Sarah Adeyemi, moved to London,<br>-- upgraded to Gold tier<br><br>UPDATE customers<br>SET<br>    last_name    = &#39;Adeyemi&#39;,<br>    city         = &#39;London&#39;,<br>    loyalty_tier = &#39;Gold&#39;<br>WHERE customer_id = 1;<br><br>-- Result: clean, simple — but 2023 sales now show<br>-- &#39;Gold / London&#39; even though she was Silver in Lagos then</pre><p><strong>✓ Use when: </strong>Historical accuracy doesn’t matter (fixing typos, correcting bad data).</p><p><strong>✗ Avoid when: </strong>You need to analyse behaviour by segment, region, or tier over time.</p><h4>Type 2 — Versioned Rows (The Workhorse)</h4><p>Type 2 is the most common SCD pattern in production warehouses. Instead of overwriting, you expire the old row and insert a new one. Every historical transaction can join to the exact dimension version that was active at the time.</p><p>This requires three extra columns: effective_date, expiry_date, and is_current.</p><pre>CREATE TABLE customers_scd2 (<br>    surrogate_key  INT PRIMARY KEY,   -- warehouse PK, never exposed<br>    customer_id    INT,               -- original business key<br>    first_name     VARCHAR(50),<br>    last_name      VARCHAR(50),<br>    city           VARCHAR(80),<br>    loyalty_tier   VARCHAR(20),<br>    email          VARCHAR(120),<br>    effective_date DATE        NOT NULL,<br>    expiry_date    DATE        DEFAULT &#39;9999-12-31&#39;,<br>    is_current     BOOLEAN     DEFAULT TRUE<br>);<br><br>-- Seed with original data (version 1 for each customer)<br>INSERT INTO customers_scd2 VALUES<br>  (1001, 1, &#39;Sarah&#39;, &#39;Bioye&#39;,   &#39;Lagos&#39;,  &#39;Silver&#39;, &#39;sarah@email.com&#39;, &#39;2022-01-01&#39;, &#39;9999-12-31&#39;, TRUE),<br>  (1002, 2, &#39;Emeka&#39;, &#39;Obi&#39;,    &#39;Abuja&#39;,  &#39;Bronze&#39;, &#39;emeka@email.com&#39;, &#39;2022-01-01&#39;, &#39;9999-12-31&#39;, TRUE),<br>  (1003, 3, &#39;Priya&#39;, &#39;Sharma&#39;, &#39;Mumbai&#39;, &#39;Gold&#39;,   &#39;priya@email.com&#39;, &#39;2022-01-01&#39;, &#39;9999-12-31&#39;, TRUE);</pre><pre>-- Step 1: Expire the current row<br>UPDATE customers_scd2<br>SET<br>    expiry_date = &#39;2025-03-01&#39;,<br>    is_current  = FALSE<br>WHERE customer_id = 1<br>  AND is_current   = TRUE;<br><br>-- Step 2: Insert the new version<br>INSERT INTO customers_scd2<br>    (surrogate_key, customer_id, first_name, last_name,<br>     city, loyalty_tier, email, effective_date, expiry_date, is_current)<br>VALUES<br>    (1004, 1, &#39;Sarah&#39;, &#39;Adeyemi&#39;,<br>     &#39;London&#39;, &#39;Gold&#39;, &#39;sarah@email.com&#39;,<br>     &#39;2025-03-01&#39;, &#39;9999-12-31&#39;, TRUE);</pre><p>Now here’s where the magic happens, point-in-time reporting:</p><pre>-- Add new sale record<br>INSERT INTO sales VALUES (105, 1, &#39;2025-04-10&#39;, 1200.00);</pre><pre>SELECT<br>    s.sale_id,<br>    s.sale_date,<br>    s.amount,<br>    c.last_name,<br>    c.city           AS city_at_time_of_sale,<br>    c.loyalty_tier   AS tier_at_time_of_sale<br>FROM sales s<br>JOIN customers_scd2 c<br>    ON  c.customer_id    = s.customer_id<br>    AND s.sale_date     BETWEEN c.effective_date AND c.expiry_date<br>WHERE s.customer_id = 1<br>ORDER BY s.sale_date;<br><br>-- 2023 sales → &#39;Chen&#39;, &#39;Lagos&#39;, &#39;Silver&#39;  ✓<br>-- 2025+ sales → &#39;Adeyemi&#39;, &#39;London&#39;, &#39;Gold&#39; ✓</pre><p>The resulting data looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*C5zI8LMFgkP2Zr2QhGThCg.png" /></figure><p><strong>✓ Use when: </strong>You need accurate historical reporting by any dimension attribute.</p><p><strong>✗ Trade-off: </strong>Table grows with every change. Query complexity increases. Surrogate key management required.</p><h4>Type 3 — Previous Value Column</h4><p>Type 3 adds a previous_* column alongside the current one. It&#39;s lighter than Type 2 but only remembers <em>one</em> prior state — so it&#39;s limited history, not full history.</p><pre>ALTER TABLE customers<br>    ADD COLUMN prev_loyalty_tier  VARCHAR(20),<br>    ADD COLUMN tier_change_date   DATE;<br><br>-- Apply Type 3 update — shift current → previous<br>UPDATE customers<br>SET<br>    prev_loyalty_tier = loyalty_tier,<br>    loyalty_tier      = &#39;Gold&#39;,<br>    tier_change_date  = &#39;2025-03-01&#39;<br>WHERE customer_id = 1;<br><br>-- Query: compare current vs previous tier<br>SELECT<br>    first_name,<br>    last_name,<br>    prev_loyalty_tier   AS old_tier,<br>    loyalty_tier        AS new_tier,<br>    tier_change_date<br>FROM customers<br>WHERE customer_id = 1;</pre><p><strong>✓ Use when: </strong>You only ever need “current vs. previous” comparisons (e.g. tier upgrade analysis).</p><p><strong>✗ Avoid when:</strong> You need more than one prior version, or don’t know which attributes will change.</p><h4>CONSIDERATIONS</h4><h4>Surrogate Keys Are Non-Negotiable in Type 2</h4><p>Your fact table should always reference the surrogate_key, not customer_id. If it references the business key, a Type 2 join will fan out across all versions. This is one of the most common mistakes in warehouse design</p><h4>Handle “Late-Arriving” Dimensions</h4><p>If a fact record arrives with a transaction date that falls <em>before</em> your most recent SCD update, you need to insert it between the correct effective/expiry windows — not just append it. Most ETL frameworks (dbt, Spark, Informatica) have built-in handling for this.</p><h4>dbt Makes SCD 2 Manageable</h4><p>In modern stacks, the dbt_utils.surrogate_key() macro and the snapshot materialisation handle Type 2 logic declaratively — you define what to track, dbt generates the expire-and-insert logic. Worth adopting if you&#39;re managing more than two or three SCD-2 tables.</p><h4>Partition on is_current in Cloud Warehouses</h4><p>In Snowflake, BigQuery, or Redshift, filtering by is_current = TRUE on an unpartitioned Type 2 table will still scan all historical rows. Add a clustering/partition key on is_current or expiry_date to keep your dashboard queries fast.</p><h4><strong>CLOSING THOUGHTS</strong></h4><p>SCD design is one of those disciplines where the “right” answer is always contextual. Start with Type 1 and Type 2 — they cover 90% of real-world cases. Reach for Type 6 only when you have a genuine need for all three access patterns simultaneously, and your team has the tooling to maintain it.</p><p>The most important habit? <em>Decide intentionally.</em> Every attribute in every dimension should have a documented SCD type. The teams that run clean warehouses are the ones where no one is guessing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6128655d2f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Change Data Capture: A Data Engineer’s Guide to Real-Time Data Pipelines]]></title>
            <link>https://medium.com/@alegeahmadolaitan/change-data-capture-a-data-engineers-guide-to-real-time-data-pipelines-06a36c622122?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/06a36c622122</guid>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[change-data-capture]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[debezium]]></category>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Tue, 24 Mar 2026 12:31:43 GMT</pubDate>
            <atom:updated>2026-03-24T12:31:43.305Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Why Your Nightly Batch Jobs Might Be Costing You More Than You Think</strong></h4><p>Picture this: It’s 3 AM, and your nightly ETL job is churning through millions of database rows, again. It’s extracting the same customer records it processed yesterday and the day before that. Maybe 0.1% of them actually changed. Your data warehouse won’t refresh until 6 AM, which means your dashboards are always hours behind reality.</p><p>Sound familiar?</p><p>This is the reality for many data teams still relying on batch processing. But there’s a better way: Change Data Capture (CDC).</p><h3>What is Change Data Capture?</h3><p>Change Data Capture is a design pattern that identifies and captures changes made to data in a database, then makes those changes available for downstream processing. Instead of periodically scanning entire tables, CDC captures only the inserts, updates, and deletes as they happen.</p><p>Think of it like this: Traditional batch processing is like taking a full inventory of a warehouse every night. CDC is like having a smart system that logs every item added, moved, or removed in real-time.</p><h3>The Core Benefits</h3><p><strong>1. Real-Time Data Access:</strong> Your analytics, ML models, and applications work with fresh data, not yesterday’s snapshot.</p><p><strong>2. Reduced Infrastructure Costs:</strong> Processing 1,000 changed rows is far cheaper than scanning 10 million rows to find those changes.</p><p><strong>3. Lower Database Load:</strong> No more heavy SELECT queries hammering your production database during peak hours.</p><p><strong>4. Complete Change History:</strong> You capture not just the current state, but the sequence of changes, critical for audit trails and temporal analytics.</p><h3>How Does CDC Actually Work?</h3><p>There are several approaches to implementing CDC, each with its own trade-offs.</p><h3>1. Log-Based CDC (The Gold Standard)</h3><p>Modern databases maintain transaction logs (also called write-ahead logs) to ensure durability and enable replication. Log-based CDC reads these logs to capture changes without touching the actual database tables.</p><p><strong>How it works:</strong></p><ul><li>Every database write (INSERT, UPDATE, DELETE) is first written to a transaction log</li><li>CDC tools read this log and convert entries into change events</li><li>These events are published to downstream systems</li></ul><p><strong>Examples:</strong></p><ul><li><strong>MySQL</strong>: Reading the binlog</li><li><strong>PostgreSQL</strong>: Reading the WAL (Write-Ahead Log)</li><li><strong>Oracle</strong>: LogMiner</li><li><strong>SQL Server</strong>: Change Data Capture feature</li></ul><p><strong>Pros:</strong></p><ul><li>Zero impact on source database performance (reading logs, not tables)</li><li>Captures all changes without modifying application code</li><li>Low latency; near real-time</li><li>Complete and accurate change history</li></ul><p><strong>Cons:</strong></p><ul><li>Requires database configuration (enabling binary logging)</li><li>More complex to set up initially</li><li>Log retention policies need management</li></ul><h3>2. Trigger-Based CDC</h3><p>Database triggers fire on INSERT, UPDATE, or DELETE operations, capturing changes into shadow tables.</p><p><strong>How it works:</strong></p><ul><li>Create triggers on source tables</li><li>Triggers write change records to separate CDC tables</li><li>A separate process reads from CDC tables and publishes events</li></ul><p><strong>Pros:</strong></p><ul><li>Works with any database that supports triggers</li><li>Can capture business logic context</li><li>Simpler to understand and debug</li></ul><p><strong>Cons:</strong></p><ul><li>Performance overhead on every write operation</li><li>Triggers can fail, causing data inconsistency</li><li>Requires schema modifications</li><li>Not truly real-time (polling CDC tables)</li></ul><h3>3. Timestamp/Version-Based CDC</h3><p>Tables include updated_at or version columns. Periodic queries identify rows changed since the last run.</p><p><strong>How it works:</strong></p><pre>SELECT * FROM orders <br>WHERE updated_at &gt; &#39;2024-03-24 10:00:00&#39;</pre><p><strong>Pros:</strong></p><ul><li>Extremely simple to implement</li><li>No special database features required</li><li>Easy to understand and maintain</li></ul><p><strong>Cons:</strong></p><ul><li>Cannot capture deletes reliably</li><li>Still requires periodic polling (not true real-time)</li><li>Requires application changes (adding timestamp columns)</li><li>Clock skew issues in distributed systems</li><li>Misses changes if updated_at not properly maintained</li></ul><h3>4. Query-Based CDC (Diff Detection)</h3><p>Periodically query tables, compare with the previous state, and identify differences.</p><p><strong>Pros:</strong></p><ul><li>Works with any database</li><li>No schema changes needed</li></ul><p><strong>Cons:</strong></p><ul><li>High database load</li><li>Expensive computations for large tables</li><li>Cannot determine the order of changes</li><li>Deletes are hard to detect</li><li>Not suitable for real-time use cases</li></ul><h3>Real-World Architecture Examples</h3><p>Let’s look at how CDC fits into actual data pipelines.</p><h3>Architecture 1: E-commerce Real-Time Analytics</h3><p><strong>Scenario:</strong> An online retailer needs real-time inventory updates across warehouses, website, and mobile apps.</p><p><strong>Architecture:</strong></p><pre>PostgreSQL (Orders, Inventory)<br>    ↓ (Debezium - Log-based CDC)<br>Apache Kafka<br>    ↓ (Stream Processing)<br>    ├→ Redis (Cache for web/mobile APIs)<br>    ├→ Elasticsearch (Real-time search)<br>    └→ Snowflake (Analytics/BI)</pre><p><strong>Why CDC here:</strong></p><ul><li>Inventory changes need to propagate instantly (prevent overselling)</li><li>Order status updates push to customer-facing apps in real-time</li><li>Analytics team gets fresh data without impacting production database</li><li>Complete audit trail of all inventory movements</li></ul><h3>Architecture 2: Financial Services Data Lake</h3><p><strong>Scenario:</strong> A bank needs to replicate transactional data to a data lake for compliance, analytics, and ML.</p><p><strong>Architecture:</strong></p><pre>Oracle Database (Core Banking)<br>    ↓ (Oracle GoldenGate - Log-based CDC)<br>Apache Kafka<br>    ↓<br>    ├→ S3 Data Lake (Parquet files)<br>    ├→ Databricks (ML Training)<br>    └→ Tableau (Executive Dashboards)</pre><p><strong>Why CDC here:</strong></p><ul><li>Regulatory compliance requires complete transaction history</li><li>ML models need near real-time fraud detection</li><li>Zero impact on mission-critical banking systems</li><li>Historical point-in-time reconstruction for audits</li></ul><h3>Architecture 3: SaaS Application Event Streaming</h3><p><strong>Scenario:</strong> A SaaS company wants to build event-driven microservices and real-time customer analytics.</p><p><strong>Architecture:</strong></p><pre>MySQL (Application Database)<br>    ↓ (Debezium on Kubernetes)<br>Kafka<br>    ↓<br>    ├→ Event-Driven Microservices<br>    ├→ Analytics Service (Clickhouse)<br>    ├→ Customer Data Platform<br>    └→ Webhook Notifier (Customer integrations)</pre><p><strong>Why CDC here:</strong></p><ul><li>Decouple services without tight database coupling</li><li>Customers get real-time webhooks for their integrations</li><li>Product analytics update instantly</li><li>Enable event sourcing patterns</li></ul><h3>Performance and Scaling Considerations</h3><p>Implementing CDC isn’t just about choosing a method; you need to design for scale and reliability.</p><h3>1. Throughput Planning</h3><p><strong>Calculate your change rate:</strong></p><ul><li>How many writes per second does your database handle?</li><li>What’s the peak vs. average?</li><li>How large is each change event?</li></ul><p>Your CDC pipeline needs to sustain throughput with headroom for spikes.</p><h3>2. Backpressure Management</h3><p>What happens when downstream systems can’t keep up?</p><p><strong>Strategies:</strong></p><ul><li><strong>Buffering</strong>: Kafka provides natural buffering with configurable retention</li><li><strong>Rate limiting</strong>: Slow down CDC readers during maintenance windows</li><li><strong>Priority queues</strong>: Critical tables processed first</li><li><strong>Dead letter queues</strong>: Failed events don’t block the pipeline</li></ul><h3>3. Schema Evolution</h3><p>Databases change. How does your CDC pipeline handle:</p><ul><li>New columns added?</li><li>Columns renamed or dropped?</li><li>Data type changes?</li></ul><p><strong>Best practices:</strong></p><ul><li>Use schema registries (like Confluent Schema Registry)</li><li>Version your event schemas</li><li>Build backward compatibility into consumers</li><li>Test schema changes in staging first</li></ul><h3>4. Failure Recovery</h3><p><strong>Key questions:</strong></p><ul><li>What if the CDC process crashes?</li><li>How do you resume without duplicates or gaps?</li><li>How do you handle network partitions?</li></ul><p><strong>Solutions:</strong></p><ul><li><strong>Checkpointing</strong>: Track log positions (binlog coordinates, LSN offsets)</li><li><strong>Idempotency</strong>: Design consumers to handle duplicate events</li><li><strong>Monitoring</strong>: Alert on lag between database writes and CDC processing</li><li><strong>Replay capability</strong>: Ability to reprocess from a specific point in time</li></ul><h3>6. Cost Optimization</h3><p>CDC infrastructure costs money. Optimize by:</p><p><strong>Selective capture</strong>: Don’t capture every table; focus on high-value, frequently-changing data</p><p><strong>Compression</strong>: Enable compression in Kafka and storage layers</p><p><strong>Tiered storage</strong>: Hot recent data in Kafka, cold historical data in S3</p><p><strong>Right-sizing</strong>: Monitor resource utilization and scale appropriately</p><h3>Common Pitfalls to Avoid</h3><h3>1. Ignoring Delete Operations</h3><p>Many CDC implementations focus on inserts and updates but forget deletes. Result? Your warehouse has “zombie records” that should be gone.</p><p><strong>Solution</strong>: Ensure your CDC method captures DELETE operations (log-based CDC does this naturally).</p><h3>2. No Schema Validation</h3><p>Pushing raw database changes downstream without validation leads to breaking consumers when schemas change.</p><p><strong>Solution</strong>: Implement schema registries and validation layers.</p><h3>3. Underestimating Initial Snapshot</h3><p>Starting CDC on a large existing database requires an initial snapshot — millions or billions of rows.</p><p><strong>Solution</strong>: Plan for snapshot bandwidth, storage, and time. Consider running during low-traffic periods.</p><h3>4. Forgetting About Ordering</h3><p>Within a single table, change order matters. But across tables? Complex.</p><p><strong>Solution</strong>: Use partition keys wisely in Kafka. Related changes (same customer, same order) should be in the same partition.</p><h3>5. No Monitoring and Alerting</h3><p>CDC is infrastructure. Treat it like any critical system.</p><p><strong>Solution</strong>: Implement comprehensive monitoring, alerting, and runbooks.</p><h3>Conclusion</h3><p>Change Data Capture represents a fundamental shift from batch to real-time data processing. It’s not just a technical upgrade — it enables entirely new classes of applications, from real-time analytics to event-driven architectures.</p><p>The transition won’t happen overnight, and it’s not right for every use case. But for data teams drowning in batch processing complexity or starving for real-time insights, CDC offers a path forward.</p><p>Start small, prove value, and scale incrementally. Your 3 AM batch jobs (and your infrastructure budget) will thank you.</p><h3>Additional Resources</h3><ul><li><strong>Debezium Documentation</strong>: Comprehensive guide to log-based CDC</li><li><strong>Confluent Kafka Connect</strong>: Managed CDC connectors</li><li><strong>AWS Database Migration Service</strong>: Managed CDC for AWS databases</li><li><strong>“Designing Data-Intensive Applications” by Martin Kleppmann</strong>: Chapter on stream processing and CDC</li></ul><p><em>Have you implemented CDC in production? What challenges did you face? I’d love to hear your experiences in the comments.</em></p><p>#DataEngineering #CDC #RealTimeData #Kafka #DataPipelines #ETL #Debezium #StreamProcessing</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06a36c622122" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Query Optimization]]></title>
            <link>https://medium.com/@alegeahmadolaitan/query-optimization-09beb835b1b3?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/09beb835b1b3</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database-optimization]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[query-optimization]]></category>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Fri, 27 Feb 2026 10:42:17 GMT</pubDate>
            <atom:updated>2026-02-27T10:42:17.047Z</atom:updated>
            <content:encoded><![CDATA[<p>As a Data Engineer (DE), query optimization is one of the most important skills you can develop. It directly impacts performance, cost, scalability, and user experience.</p><p>Query optimization is the process of improving the performance of database queries by revising their execution plan, structure, or indexing strategy to ensure they retrieve data efficiently. This includes techniques that make queries:</p><ul><li>Run faster</li><li>Use fewer resources (CPU, memory)</li><li>reduce cost (especially in cloud platforms)</li><li>scale efficiently with larger datasets.</li></ul><h3>WHY QUERY OPTIMIZATION IS CRITICAL FOR DEs</h3><h4>Cost Control</h4><p>In cloud platforms like Snowflake, Databricks, etc., you pay per data scanned or compute time, and bad queries directly translate to higher bills. Optimized queries reduce scanned data, compute time, and storage usage.</p><h4>Pipeline Performance</h4><p>Slow queries delay dashboards, break SLAs, and increase batch window time. By optimizing queries, we improve transformation speed, make pipelines more reliable, and reduce orchestration failures.</p><h4>Scalability</h4><p>A query that works on 500k rows might fail on a million rows, and if it doesnt, a billion-row table might break it, or it might become extremely slow. Optimization ensures linear scalability.</p><h4>Better Resource Management</h4><p>Poor queries can lock tables, cause memory spills, and impact other workloads. Optimization helps protect shared systems.</p><h3>CORE QUERY OPTIMIZATION TECHNIQUES</h3><h4>INDEXING</h4><ul><li>Create indexes on columns used in WHERE, JOIN, and ORDER BY clauses</li><li>Use composite indexes for multi-column filters reduce scan time, but you need to balance read performance against write overhead and storage costs. Understanding cardinality and selectivity helps you choose which columns to index.</li><li><strong>WHY</strong>: Indexes dramatically reduce scan time, but you need to balance read performance against write overhead and storage costs. Understanding cardinality and selectivity helps you choose which columns to index.</li></ul><h4>QUERY REWRITING</h4><ul><li>Avoid SELECT *, specify only needed columns</li><li>Push predicates down (filter early)</li><li>Use EXISTS instead of IN for large subqueries</li><li><strong>WHY</strong>: Column pruning and predicate pushdown are fundamental to distributed query engines (Spark, Presto). You optimize data movement across nodes.</li></ul><h4>PARTITIONING</h4><ul><li>Partition large tables by date, region, or other logical segmentation</li><li>Pruning eliminates scanning irrelevant partitions</li><li><strong>WHY: </strong>You design table structures for long-term scalability. Proper partitioning means that queries only touch relevant data slices, which is crucial for petabyte-scale data warehouses.</li></ul><h4>JOIN OPTIMIZATION</h4><ul><li>Use appropriate join types (broadcast vs shuffle joins)</li><li>Denormalize when appropriate to avoid excessive joins</li><li>Join smaller tables first (When you join tables, you create intermediate results and subsequent join operations on these results. Smaller intermediate results = less data to process in later joins). EXAMPLE:</li></ul><pre>-- Table sizes<br>Customers: 1M rows<br>Orders: 10M rows  <br>OrderItems: 50M rows</pre><pre>-- Bad order<br>SELECT *<br>FROM OrderItems oi<br>JOIN Orders o ON oi.order_id = o.id<br>JOIN Customers c ON o.customer_id = c.id<br>WHERE c.country = &#39;USA&#39;  -- Only 100K customers</pre><pre>-- Better order<br>SELECT *<br>FROM Customers c<br>JOIN Orders o ON c.customer_id = o.id<br>JOIN OrderItems oi ON o.order_id = oi.id<br>WHERE c.country = &#39;USA&#39;</pre><ul><li><strong>WHY</strong>: In distributed systems, shuffle joins are expensive. You design schemas and ETL pipelines that minimize network I/O.</li></ul><h4>MATERIALIZED VIEWS AND CACHING</h4><ul><li>Pre-aggregate common query patterns</li><li>Cache frequently accessed datasets</li><li><strong>WHY</strong>: You build data pipelines that pre-compute expensive operations, trading storage for compute and reducing query latency from minutes to seconds. This is especially critical for repetitive analytical queries and dashboards that would otherwise recompute the same aggregations thousands of times daily.</li></ul><p>Beyond these core techniques, effective query optimization also includes:</p><ol><li>Use EXPLAIN Plans (understand execution before optimization)</li><li>Reduce Data Movement (Critical in Distributed Systems)</li><li>Use CTEs and Subqueries Wisely (improve readability and enable optimization)</li><li>Use columnar formats like Parquet, ORC (reduce I/O for analytical workloads)</li><li>Keep table/column statistics updated (enable cost-based optimizer decisions)</li></ol><p>The key difference for DEs is that we’re not just optimizing individual queries but designing entire data architectures, pipelines, and storage strategies that make efficient queries possible at scale. You think about data lifecycle, costs, processing windows, and system-wide performance, not just single-query execution time.</p><h3>CONCLUSION</h3><p>Query optimization is foundational to data engineering excellence. The techniques you’ve learned from indexing and partitioning to broadcast joins and materialized views are tools in service of a larger goal: building data systems that are fast, cost-effective, and scalable.</p><p>The best data engineers think holistically. They don’t just fix slow queries; they design architectures that prevent performance problems before they arise. They understand that every optimization involves trade-offs and make decisions that align with business priorities.</p><p>As you apply these techniques, remember that optimization is a journey, not a destination. Data grows, requirements evolve, and technologies advance. Keep measuring, keep learning, and keep refining. Your expertise in query optimization doesn’t just improve performance metrics, it unlocks the full potential of your organization’s data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09beb835b1b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Spark Series, Part 4: The Advanced Ecosystem]]></title>
            <link>https://medium.com/@alegeahmadolaitan/apache-spark-series-part-4-the-advanced-ecosystem-59bda6b727f1?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/59bda6b727f1</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[spark-streaming]]></category>
            <category><![CDATA[pyspark]]></category>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[spark-mllib]]></category>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Thu, 19 Feb 2026 10:37:09 GMT</pubDate>
            <atom:updated>2026-02-19T10:37:09.022Z</atom:updated>
            <content:encoded><![CDATA[<p>Structured Streaming and MLlib</p><p>This is Part 4 of a four-part series on Apache Spark. In this final article, we explore Spark’s advanced ecosystem — Structured Streaming and MLlib — and how they build on the execution and optimization layers discussed in the previous parts.</p><h4>INTRODUCTION</h4><p><strong>One engine, many workloads</strong></p><p>By now, we’ve explored Spark from the inside out.</p><p>In Part 1, we examined the execution engine: drivers, executors, stages, and DAG scheduling.<br>In Part 2, we moved up the stack into DataFrames, Spark SQL, Catalyst, and Tungsten.<br>In Part 3, we focused on the mechanisms that shape performance in real workloads.</p><p>Now we zoom out.</p><p>Spark is not just a batch processing engine — it’s a unified system supporting batch analytics, streaming pipelines, and machine learning workloads. Structured Streaming and MLlib aren’t separate systems bolted onto Spark; they’re layers reusing the same DAG scheduler, optimizer, and physical execution engine.</p><p>Different APIs. Same foundation.</p><h4><strong>STRUCTURED STREAMING</strong></h4><p><strong>Streaming as an incremental batch</strong></p><p>Batch processes bounded datasets. Streaming processes continuously arriving, unbounded data. Spark’s insight was to unify them.</p><p>Structured Streaming treats streaming as incremental batch processing, reusing the DataFrame and Spark SQL APIs. You write transformations exactly as you would for batch workloads. Rather than running once over a static dataset, Spark executes the same logical plan repeatedly over micro-batches of new data — each processed through the same optimizer and physical engine.</p><p>Streaming doesn’t replace Spark Core. It orchestrates repeated execution through it.</p><h4><strong>STATE, WATERMARKING, AND FAULT TOLERANCE</strong></h4><p>Streaming introduces complexity batch doesn’t: state. Aggregations over streams require maintaining intermediate state across batches, introducing considerations around memory, checkpointing, late-arriving data, and windowing.</p><p>Spark handles late data through watermarking — defining how long to wait for late events before finalizing results. Checkpointing records offsets, state snapshots, and metadata for consistent failure recovery.</p><p>Despite these additions, each micro-batch still builds, optimizes, and executes a physical plan through the same core engine. The difference is continuity, not architecture.</p><h4><strong>CONTINUOUS EXECUTION AND PERFORMANCE CONSIDERATIONS</strong></h4><p>The performance principles from Part 3 apply almost unchanged to streaming — shuffles still dominate cost, partitioning still shapes parallelism, skew still creates stragglers, and broadcast joins still eliminate expensive stages.</p><p>You don’t need a new mental model for streaming performance. You extend the one you already built.</p><p>Streaming is repeated, stateful execution of the same optimized plans.</p><h4>MLLIB</h4><p><strong>Distributed machine learning on Spark</strong></p><p>Machine learning introduces a different workload: feature extraction, vectorization, model training, iterative optimization, and evaluation. At first glance, this seems far removed from Spark’s core abstractions. It isn’t.</p><p>MLlib is built directly on DataFrames and Spark SQL. Feature engineering becomes column operations, transformers become plan nodes, and model training becomes distributed computation across partitions. The same execution engine handles it all.</p><p>The performance principles from Part 3 reappear: shuffles occur during aggregations, partitioning affects training parallelism, caching stabilizes iterative workflows, and broadcast variables distribute model parameters efficiently.</p><p><strong>PIPELINES, FEATURE ENGINEERING, AND MODEL TRAINING AT SCALE</strong></p><p>MLlib’s Pipeline API lets developers define ordered stages — data ingestion, feature transformation, model training, and evaluation. Each stage is either a Transformer (transforming a DataFrame) or an Estimator (fitting a model to produce a Transformer).</p><p>Since features are just columns, Catalyst can optimize projections, filters, and joins before training begins. Caching becomes critical in iterative algorithms — without persistence, Spark recomputes entire feature pipelines on each iteration.</p><p>Machine learning is computationally heavy, but architecturally familiar.</p><p>Structured Streaming, MLlib, batch analytics — all converge on the same mechanism. A logical plan is built, analyzed, and optimized into a physical plan, broken into stages, and executed as tasks across executors.</p><p>No matter how high-level the API, the execution model doesn’t fundamentally change. The abstraction layers add expressiveness, but they don’t replace the engine underneath.</p><p><strong>WHEN SPARK IS THE RIGHT TOOL</strong></p><p>Spark excels at large-scale structured data processing, distributed transformations and aggregations, unified batch and streaming pipelines, and scaling machine learning across clusters.</p><p>It may not be ideal when millisecond latency is required, workloads fit on a single node, specialized ML frameworks offer better hardware utilization, or strict real-time semantics exceed micro-batch constraints.</p><p>Understanding Spark deeply means knowing when not to use it.</p><p><strong>FINAL REFLECTIONS</strong></p><p>Across four parts, we moved through Spark layer by layer: the core engine, the modern API layer, the performance layer, and the advanced ecosystem.</p><p>What emerges is a layered architecture where each abstraction builds on the one beneath it and every workload maps back to the same execution model. Spark is powerful not because it does many things, but because it does many things with a single, consistent engine.</p><p><strong>CLOSING THOUGHTS</strong></p><p>If one idea ties this series together, it’s this: Spark is a query planning and distributed execution system. The APIs may evolve, the ecosystem may expand, but the core principles remain stable — build logical plans, optimize them, translate them into DAGs, execute tasks in parallel.</p><p>Once you understand these layers, Spark stops feeling unpredictable. It becomes a system you can reason about. And that, more than any optimization trick or configuration flag, is what makes working with distributed systems sustainable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59bda6b727f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Spark Series, Part 3: Performance Tuning in Practice]]></title>
            <link>https://medium.com/@alegeahmadolaitan/apache-spark-series-part-3-performance-tuning-in-practice-392deec562f7?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/392deec562f7</guid>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 09:36:01 GMT</pubDate>
            <atom:updated>2026-02-11T09:36:01.054Z</atom:updated>
            <content:encoded><![CDATA[<p>Shuffles, Partitioning, Caching, and Broadcast Variables</p><p><em>This is Part 3 of a four-part series on Apache Spark. This article focuses on the performance-critical mechanisms that shape real Spark workloads, building on the execution engine and optimization layers explored in </em><a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71"><em>Part 1</em></a><em> and </em><a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-2-the-modern-api-layer-7e4b565c9921"><em>Part 2</em></a><em>.</em></p><h3>INTRODUCTION</h3><p>Most Spark jobs don’t fail because the logic is wrong. They fail because they are slow, unstable, or unexpectedly expensive.</p><p>Clusters scale up. Runtimes grow nonlinearly. Jobs that worked yesterday suddenly time out today. Often, the code hasn&#39;t changed, the data has. This is where Spark performance tuning begins, not with configuration flags or executor memory tweaks, but with understanding how Spark moves data.</p><p><a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71">Part 1</a> and <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-2-the-modern-api-layer-7e4b565c9921">Part 2</a> explored how Spark executes work and how modern APIs translate into optimized plans. This article focuses on what actually dominates production runtime: shuffles, partitioning decisions, caching behaviour, and broadcast variables.</p><p>These mechanisms aren&#39;t optional optimizations; they define your job’s shape. Two Spark programs computing identical results can differ by an order of magnitude in runtime and cost, depending on how these mechanisms are triggered and combined.</p><p>The goal of this article isn’t to provide tuning rules but to build a mental model that lets you reason about performance before problems even arise.</p><h3>SHUFFLES</h3><p><strong>The real boundary in Spark</strong></p><p>If one concept explains most Spark performance issues, it is the shuffle.</p><p>A shuffle occurs when Spark redistributes data across the cluster. Records are reorganized by key, written out by one set of tasks, transferred across the network, and read by another.</p><p>This is expensive. A shuffle involves:</p><ul><li>Network I/O</li><li>Disk I/O</li><li>Serialization and deserialization</li><li>Memory pressure</li><li>Coordination between executors</li></ul><p>More importantly, a shuffle introduces a stage boundary. Everything before the shuffle must be completed before anything after it can begin. Common operations that trigger shuffles include:</p><ul><li>groupBy</li><li>reduceByKey</li><li>distinct</li><li>joins (unless broadcast)</li><li>repartition</li></ul><p>From Spark’s perspective, a shuffle isn’t just data movement — it’s a synchronization point. It forces the DAG to split into stages, limits pipelining, and amplifies skew. This explains why “simple-looking” jobs behave poorly at scale. A single wide transformation can dominate the entire execution timeline.</p><p>Understanding where shuffles occur, and whether it is necessary is the first step in performance tuning.</p><h3>PARTITIONING</h3><p><strong>Shaping how work is distributed</strong></p><p>Partitioning defines how work is divided, determining how many tasks Spark can run in parallel, how much data each task processes, and how evenly work is distributed across executors.</p><p>Too few partitions lead to underutilized resources and long-running tasks. Too many introduce overhead, scheduling pressure, and excessive shuffle files.</p><p>Partitioning interacts directly with shuffles. When Spark shuffles, it redistributes data into a new partitioning scheme, usually hash-based by default. Skewed data creates oversized partitions, producing stragglers that delay the entire job.</p><p>Key concepts to internalize:</p><ul><li>Parallelism is bounded by partitions</li><li>skew breaks parallelism</li><li>partitioning decisions compound across stages</li></ul><p>Spark provides multiple ways to influence partitioning:</p><ul><li>default shuffle partition settings</li><li>explicit repartition and coalesce operations</li><li>hash vs range partitioning</li><li>partitioning-aware joins.</li></ul><p>Partitioning isn’t micro-optimization, it is about shaping the execution graph so work is predictable and evenly distributed. Well-partitioned data leads to stable pipelines. Poor partitioning leads to performance cliffs.</p><h3>CACHING AND PERSISTENCE</h3><p><strong>Trading memory for recomputation</strong></p><p>By default, Spark doesn’t cache intermediate results; this is intentional. Spark relies on lineage to recompute data when needed, supporting fault tolerance and avoiding unnecessary memory use. However, if the same computation is referenced multiple times, Spark may recompute it repeatedly.</p><p>Caching changes this. When a dataset is cached or persisted, Spark stores its materialized partitions in memory (or another storage level) after the first computation. Subsequent actions reuse these results instead of recomputing the entire lineage.</p><p>This is powerful and “dangerous”.</p><p>Caching helps when the same dataset is reused across multiple actions, a computation is expensive and deterministic, and the cached data comfortably fits in memory. Caching hurts when the dataset is large, used only once, or causes eviction of more valuable cached data.</p><p>Distinguish caching from checkpointing. Caching is an optimization. Checkpointing is a correctness and stability mechanism that truncates lineage and writes data to reliable storage, often used in long-running or iterative workflows. Caching keeps lineage intact and focuses on speed.</p><p>Blind caching is one of the most common Spark anti-patterns. Effective caching is deliberate, limited, and informed by reuse.</p><h3>BROADCAST VARIABLES</h3><p><strong>Changing the shape of joins</strong></p><p>Broadcasting is one of the few optimizations that can fundamentally alter a Spark job’s DAG.</p><p>Normally, joins require a shuffle; both sides are repartitioned so matching keys can be colocated. This is expensive and often unavoidable.</p><p>Broadcast joins change the equation. When one side is small enough, Spark broadcasts it to all executors. Each executor keeps a local copy and performs the join without shuffling the larger dataset.</p><p>The result: no shuffle for the large side, fewer stages, and lower runtime. Broadcast variables enable this by efficiently distributing read-only data to all executors.</p><p>However, broadcasting has limits:</p><ul><li>The broadcast data must fit in the executor memory</li><li>Oversized broadcasts can cause memory pressure or failures</li><li>Not all joins benefit from broadcasting</li></ul><p>Broadcasting isn&#39;t just a performance trick; it is a structural optimization that changes how data flows through the system. Used correctly, it eliminates entire shuffle stages. Used incorrectly, it destabilizes jobs.</p><h3>HOW THESE MECHANISMS INTERACT</h3><p>Shuffles, partitioning, caching, and broadcasting don’t operate in isolation; in real jobs, they compound.</p><p>A shuffle introduces new partitions. Partitioning determines how shuffled records are distributed. Caching may lock in poor partitioning choices. Broadcasting can eliminate entire shuffles.</p><p>This is why Spark performance tuning is rarely about a single knob. For example:</p><ul><li>Repartitioning before a join may reduce skew, but introduce an extra shuffle</li><li>Broadcasting a dimension table may remove a shuffle, but increase memory pressure</li><li>Caching a dataset before a wide transformation may stabilize repeated access, but amplify partition imbalance</li></ul><p>The key insight: Spark performance emerges from data movement patterns, not individual transformations. Each decision reshapes the DAG, often in ways not obvious from code alone.</p><p>The most effective tuning comes from reasoning about how these mechanisms interact before execution begins. This is why understanding the execution engine from <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71"><em>Part 1</em></a><em> </em>and the planning layer from <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-2-the-modern-api-layer-7e4b565c9921"><em>Part 2</em></a> is essential; performance tuning requires seeing how your high-level code translates into actual data movement.</p><h3>A PERFORMANCE FIRST MODEL</h3><p>To reason about Spark performance consistently, adopt a set of guiding questions. Before running a job, ask:</p><ul><li>Where are the shuffle boundaries?</li><li>How large is the data on each side of those boundaries?</li><li>How many partitions will exist after each shuffle?</li><li>Is any dataset reused across multiple actions?</li><li>Could any join be reshaped with broadcasting?</li></ul><p>This shifts focus from functions to flow. Performance tuning becomes less trial-and-error and more architecture. You stop reacting to slow jobs and start predicting them. Physical plans are especially valuable — they show where Spark plans to shuffle, which join strategies are selected, and how many stages will be created. Reading these plans with a performance mindset connects <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-2-the-modern-api-layer-7e4b565c9921"><em>Part 2</em></a><em>&#39;s</em> planning layer with <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71"><em>Part 1</em></a>’s execution realities.</p><h3>COMMON PERFORMANCE ANTI-PATTERNS</h3><p>Most Spark performance problems aren’t exotic; they’re familiar mistakes repeated at scale. Common issues include:</p><ul><li><strong>Blind caching</strong><br> Persisting large datasets without understanding reuse or memory impact.</li><li><strong>Over-partitioning</strong><br> Creating thousands of tiny tasks that overwhelm the scheduler.</li><li><strong>Ignoring skew</strong><br> Allowing a few partitions to dominate execution time.</li><li><strong>Uncontrolled broadcasting</strong><br> Broadcasting datasets that are too large or volatile.</li><li><strong>Debugging only after deployment</strong><br> Waiting for production failures instead of reasoning from plans and data sizes.</li></ul><p>These issues often coexist. A single job may suffer from all simultaneously. The solution is rarely a configuration change; it is usually a design correction.</p><h3>KEY TAKEAWAYS</h3><p>Spark performance is not mysterious.</p><ul><li>Shuffles dominate runtime and cost</li><li>Partitioning shapes parallelism and stability</li><li>Caching trades recomputation for memory</li><li>Broadcasting can eliminate entire stages</li><li>Performance tuning is architectural, not cosmetic</li></ul><p>Once you understand how data moves, Spark becomes predictable.</p><h3>WHATS NEXT</h3><p>Part 4 moves beyond batch processing into Spark’s broader ecosystem. We’ll explore Structured Streaming and continuous execution, how Spark applies the same engine to streaming workloads, MLlib and distributed machine learning, and why these components still rely on the same core principles.</p><p>Different APIs. Different workloads. The same execution engine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=392deec562f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Spark Series, Part 2: The Modern API Layer]]></title>
            <link>https://medium.com/@alegeahmadolaitan/apache-spark-series-part-2-the-modern-api-layer-7e4b565c9921?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e4b565c9921</guid>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Wed, 04 Feb 2026 10:06:00 GMT</pubDate>
            <atom:updated>2026-02-04T10:06:00.797Z</atom:updated>
            <content:encoded><![CDATA[<p>DataFrames, Datasets, and Spark SQL</p><p><em>This is Part 2 of a four-part series on Apache Spark. This article focuses on Spark’s modern APIs and optimization layer, building on the execution engine and DAG model introduced in </em><a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71"><em>Part 1</em></a><em>.</em></p><h3>INTRODUCTION</h3><p><strong>How Spark became a query engine</strong></p><p>Most Spark code today is written using DataFrames and SQL, not RDDs.</p><p>For many engineers, Spark no longer feels like a low-level distributed computation framework but rather a distributed database engine where you describe what you want and the system determines how to execute it.</p><p>This wasn’t always the case. Early Spark applications were procedural; you constructed RDDs, applied transformations step by step, and manually managed partitions, joins, and persistence, placing the optimization burden entirely on developers.</p><p>Instead of instructing Spark exactly how to process data, you now express high-level intent: select columns, filter rows, group by keys, and join datasets. This relational database model fundamentally transformed Spark’s capabilities.</p><p>This shift mattered for several reasons.</p><p>Declarative code lets Spark analyze entire computations upfront, reorganizing operations, removing redundant work, and selecting optimal execution strategies. This enabled sophisticated query planning; rewriting queries, reordering operations, and choosing physical plans based on actual data rather than developer assumptions. It also improved stability by catching schema errors during validation before execution, eliminating failures that previously emerged mid-job. Finally, it unified behavior across SQL, Python, Scala, R, and Java, ensuring all APIs generate identical internal plans and execution paths.</p><p>This article explores this modern layer of Spark.</p><p>We’ll explore how DataFrames and Datasets are represented internally, how Spark SQL analyzes and optimizes them into physical execution plans, and where the Tungsten execution engine fits in to reshape Spark’s performance.</p><h3>THE LAYERED SPARK STACK</h3><p><strong>From Spark Core to Spark SQL</strong></p><p>To understand modern Spark, it helps to view it as a layered system. At the foundation sits Spark Core. This is the engine described in <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71"><em>Part 1</em>.</a> It is responsible for:</p><ul><li>Building and scheduling DAGs</li><li>Breaking work into stages and tasks</li><li>Managing memory and execution</li><li>Handling shuffles and fault tolerance</li><li>Communicating with the cluster manager and executors</li></ul><p>Spark Core knows how to execute work, but it does not understand tables, schemas, or SQL. It operates on distributed tasks and dependencies, not on queries.</p><p>Above this sits <strong>Spark SQL.</strong></p><p>Spark SQL is not just a SQL parser. It is a full optimization and planning layer. This module introduces:</p><ul><li>Structured data and schemas</li><li>Logical and physical query plans</li><li>The Catalyst optimizer</li><li>The Tungsten execution backend</li></ul><p>This is where modern Spark truly lives.</p><p>DataFrames and Datasets are part of Spark SQL.</p><p>Although they feel like core Spark abstractions, they are not part of the original Spark Core. They are structured APIs built on top of it. When you manipulate a DataFrame or run a SQL query, you are not creating tasks directly. You are constructing a <strong>logical plan</strong> that Spark SQL will analyze and optimize before anything is executed.</p><p>This layered design is what allows Spark to support multiple high-level interfaces while preserving a single execution model.</p><p>At the top of this stack sits the <strong>SparkSession</strong>.</p><p>SparkSession is the unified entry point that replaced early Spark’s scattered contexts. It coordinates access to Spark Core and Spark SQL, managing configuration, catalog access, and query execution, whether you’re running SQL, creating DataFrames, or loading data sources.</p><p>The older SparkContext still exists but now operates beneath the surface, handling low-level concerns like resource management, broadcast variables, and accumulator coordination. Developers rarely interact with it directly in modern applications.</p><p>Despite this expanded stack, all computation converges on the same destination. SQL queries, DataFrame operations, Dataset transformations, and legacy RDD code are compiled into physical execution plans, then translated into stages and tasks for Spark Core’s scheduler.</p><p>From there, execution mirrors <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71"><em>Part 1</em></a>: tasks are distributed to executors, shuffles are coordinated, memory is managed, and results are computed. The APIs and planners differ, but the execution engine remains the same.</p><p>Understanding this layered architecture explains how Spark behaves like a database, optimizes like a query planner, and operates like a distributed execution engine underneath.</p><h3>DATAFRAMES</h3><p><strong>Spark’s primary abstraction</strong></p><p>In modern Spark, the Dataframe is the dominant abstraction. While RDDs still exist, most production workloads now use DataFrames or SQL, reflecting a deeper architectural shift in how Spark represents computation.</p><p>A Dataframe is not a collection of objects but a distributed table with a known schema, defined by named columns, data types, and a lineage of transformations expressed as relational operations.</p><p>When you write DataFrame code, you’re not manipulating data directly; you’re building a logical plan, a structured description of the computation to perform. This distinction is critical. Operations like select, filter, groupBy, and join don&#39;t execute immediately. They construct query plan nodes. Spark records what you want, not how to do it. Execution only begins when an action triggers plan compilation.</p><p>This enables modern Spark’s optimization capabilities. Because Spark understands data structure and operation semantics, it can reorder filters and projections, remove unused columns, collapse transformations, push predicates into data sources, and select efficient join strategies. None of this is reliably possible with unstructured RDDs — Spark sees opaque functions with RDDs, but sees a query with DataFrames.</p><p>This also makes DataFrames language-independent. DataFrames created in Python, SQL, or Scala produce identical internal logical representations. The APIs differ, but the underlying plans don’t.</p><p>The key insight: DataFrames are computation blueprints, not actual data. They describe what work should happen, not the results themselves.</p><p>RDDs are distributed collections that execute transformations immediately, giving you control but preventing Spark from seeing the full picture. DataFrames sacrifice some of that control so Spark can analyze the entire computation before running it.</p><p>This ability to inspect and optimize queries is what powers modern Spark.</p><h3>SPARK SQL AND CATALYST</h3><p><strong>How Spark turns logic into optimized plans</strong></p><p>Spark SQL transforms DataFrames and SQL queries into optimized physical execution plans that Spark Core can run. This happens in several phases.</p><p>First, Spark builds an unresolved logical plan representing the query’s structure, where column names and types aren’t yet validated or bound to data sources.</p><p>Next, the analyzer resolves the plan by connecting column references to schemas, performing catalog lookups, verifying types, and ensuring semantic validity. This produces an analyzed logical plan — a structurally correct computation description.</p><p>Then <strong>Catalyst</strong>, Spark’s query optimization framework, applies rule-based and cost-based transformations. Key optimizations include predicate pushdown (moving filters close to data sources), column pruning (eliminating unused columns early), constant folding (precomputing static expressions), join reordering (restructuring multi-join queries to minimize intermediate data), and join strategy selection (choosing broadcast, sort-merge, or shuffle hash joins based on data characteristics).</p><p><strong>Catalyst </strong>outputs an optimized logical plan. From this, Spark generates physical plans describing not just what to compute, but how — which operators to use, how to partition data, and where shuffles occur.</p><p>You can observe this through the explain() command interface, which shows the unresolved, analyzed, optimized, and physical plans. Simple DataFrame transformations often become sophisticated execution strategies.</p><p>This planning phase makes Spark behave like a query engine. Rather than executing transformations as written, Spark constructs a global view, rewrites it, then commits to a physical strategy. Developers express intent; Spark decides execution.</p><p>This decision layer, not the API, ultimately determines performance.</p><h3>TUNGSTEN</h3><p><strong>The physical execution engine</strong></p><p>If Catalyst decides what to do, Tungsten decides how to do it efficiently.</p><p>Early Spark relied on the JVM object model — data lived as Java or Scala objects, causing high garbage collection overhead and poor CPU efficiency. As workloads grew, memory pressure and serialization costs became major bottlenecks.</p><p>Project Tungsten fundamentally re-architected Spark’s physical layer around memory layout, cache locality, and CPU efficiency.</p><p>Its key contribution is off-heap memory management. Instead of storing data purely as JVM objects, Spark manages raw memory directly, reducing garbage collection overhead, improving cache behavior, and providing tighter memory control. Tungsten also introduced binary, columnar data representation during execution. Rows are packed into compact formats that are cheaper to transmit, faster to scan, and more CPU-friendly.</p><p>On top sits whole-stage code generation. Rather than interpreting operators individually, Spark generates optimized Java bytecode that fuses multiple operators into single execution loops. Filters, projections, and aggregations compile into tight loops, minimizing virtual calls, branching, and object creation.</p><p>Large portions of Spark queries now behave like a compiled query engine rather than a general-purpose framework.</p><p>Tungsten also enables vectorized processing, efficient sorting and hashing, better CPU utilization, and predictable memory behavior under heavy workloads.</p><p>This explains why modern Spark performance discussions resemble database internals rather than distributed scripting frameworks. The physical engine pushes work into fast, low-level execution paths.</p><p>Catalyst chooses the plan. Tungsten makes it fast.</p><h3>DATASETS</h3><p><strong>Where type safety fits (and where it doesn’t)</strong></p><p>Datasets bridge two worlds: DataFrames’ untyped flexibility and strongly typed JVM languages’ compile-time safety.</p><p>A Dataset is essentially a DataFrame with a type parameter. Instead of treating rows as generic structures, Datasets let you express computations using domain objects. Spark uses encoders to map these objects into its internal binary representation, enabling typed transformations while preserving Catalyst optimization and Tungsten execution.</p><p>In theory, this offers compile-time type safety, object-oriented modeling, and optimized execution simultaneously.</p><p>In practice, adoption has been mixed. Datasets are only supported in Scala and Java, unavailable in Python and R, limiting universality. They also add complexity: encoders, serialization boundaries, and less transparent physical behavior.</p><p>Many teams find that DataFrames provide sufficient safety through schemas and validation while remaining simpler and more interoperable. DataFrames have become dominant even in JVM-based codebases.</p><p>That said, Datasets have a real niche. They’re particularly useful for large, strongly typed JVM pipelines where domain modeling matters, compiler assistance aids refactoring and correctness, and you’re building reusable Spark libraries. In these contexts, Datasets significantly improve maintainability without abandoning Spark’s optimization pipeline.</p><p>The key conceptual point: Datasets don’t bypass Spark SQL. They’re not closer to the metal than DataFrames — they’re another API that still produces logical plans, flows through Catalyst, and executes on Tungsten.</p><p>The type system enriches the interface. It doesn’t replace the engine.</p><h3>FROM DATAFRAME TO DAG</h3><p><strong>Connecting modern Spark back to the core engine</strong></p><p>At the API level, modern Spark feels far removed from <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71"><em>Part 1’</em></a>s execution engine. You write declarative transformations, inspect schemas, and reason about queries — no tasks, stages, or schedulers in sight.</p><p>Internally, however, everything flows through the core engine. Every DataFrame operation, Dataset transformation, and SQL query follows this path:</p><ol><li>An unresolved logical plan is constructed from your code</li><li>The plan is analyzed and validated against schemas and catalogs</li><li>Catalyst produces an optimized logical plan</li><li>Spark generates physical plans</li><li>A physical plan converts into stages and tasks</li><li>Spark Core schedules those tasks across the cluster</li></ol><p>At this final step, Part 2 reconnects with <a href="https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71"><em>Part 1</em></a>.</p><p>Physical operators — scans, joins, aggregations — decompose into execution stages. Wide transformations introduce shuffle boundaries. Narrow transformations pipeline together. The result is a DAG of stages, identical to the core engine’s.</p><p>The optimizer may completely reshape the query. The execution engine still executes tasks.</p><p>This is where modern Spark’s abstraction ends. No matter how high-level the API, every job ultimately becomes tasks executing inside executors, stages coordinated by the driver, shuffles transferring partitions across the cluster, and memory and CPU managed by Spark Core.</p><p>Understanding this mapping lets you reason across layers. When you inspect a physical plan, you’re not looking at an academic artifact — you’re looking at the blueprint from which your DAG will be built.</p><p>This is why explained plans are so powerful. They show the moment declarative intent becomes concrete execution.</p><h3>CHOOSING THE RIGHT ABSTRACATION</h3><p>With multiple APIs available, the question arises: when should each be used?</p><p>In practice, the decision is rarely about capability — most production workloads can be expressed with DataFrames. It’s about control, visibility, and optimization.</p><p>RDDs offer the most direct control, explicitly exposing partitions, functions, and execution flow. They’re suitable for unstructured data, custom algorithms, and low-level transformations that don’t fit relational models. But they hide intent from Spark, limiting optimization and making performance tuning largely manual.</p><p>DataFrames are the modern default. They expose structure, enabling full Catalyst and Tungsten operation. They’re well-suited for ETL pipelines, analytics and reporting, feature engineering, and large-scale transformations. They maximize optimization potential while remaining expressive.</p><p>Datasets occupy a narrower space, trading simplicity for type safety and domain modeling. They’re most useful when building large JVM-based systems, writing reusable Spark components, or modeling complex business objects.</p><p>Across all these, one principle holds: the more structure Spark can see, the more it can optimize.</p><h3>KEY TAKEAWAYS</h3><p>Modern Spark is not just a compute engine — it’s a query planning and execution system.</p><ul><li>DataFrames are logical plans, not datasets</li><li>Spark SQL is Spark’s reasoning layer, not just SQL</li><li>Catalyst transforms intent into optimized strategies</li><li>Tungsten turns strategies into efficient execution</li><li>All APIs ultimately converge on the same DAG-based core engine</li></ul><p>Once this model is internalized, Spark stops feeling magical and becomes understandable.</p><h3><strong>WHAT’S NEXT</strong></h3><p>Part 3 moves from architecture into performance reality. We’ll examine the mechanisms that dominate real Spark workloads: shuffles and stage boundaries, partitioning strategies, caching and persistence, broadcast variables, and how to reason about performance before tuning.</p><p>If Part 2 is about how Spark plans work, Part 3 is about how Spark jobs actually succeed — or fail — at scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e4b565c9921" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Spark Series, Part 1: Inside the Core Engine]]></title>
            <link>https://medium.com/@alegeahmadolaitan/apache-spark-series-part-1-inside-the-core-engine-5f426cfd6d71?source=rss-e8049998515c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f426cfd6d71</guid>
            <dc:creator><![CDATA[Alege Ahmad Olaitan ]]></dc:creator>
            <pubDate>Mon, 26 Jan 2026 08:22:43 GMT</pubDate>
            <atom:updated>2026-01-26T08:22:43.928Z</atom:updated>
            <content:encoded><![CDATA[<p>Architecture, RDDs, and the DAG</p><p><em>This is Part 1 of a four-part series on Apache Spark, moving from the core execution engine to modern APIs, performance tuning, and advanced workloads. This article focuses on Spark’s internal architecture and execution model.</em></p><h4>INTRODUCTION</h4><p>Apache Spark is often presented as a friendly analytics platform: load data, chain a few transformations, run a query, train a model. With today’s high-level APIs, it’s entirely possible to build large data pipelines without ever thinking about what Spark is actually doing underneath.</p><p>But when Spark jobs become slow, expensive, or unstable, the abstractions stop being enough.</p><p>Most real production issues in Spark are not API problems. They are execution problems. They come from how Spark builds plans, moves data, schedules tasks, and recovers from failure. And those behaviors only make sense once you understand Spark’s core engine.</p><p>This article is the first part of a four-part series on Apache Spark. In this part, we step below DataFrames and SQL and look at the machinery that powers everything else. We will explore:</p><ul><li>The distributed architecture of a Spark application</li><li>Resilient Distributed Datasets (RDDs) and the execution model they introduced</li><li>How Spark builds and executes a Directed Acyclic Graph (DAG) of computation</li></ul><p>The goal is not to memorize internal components or configuration flags. The goal is to build a mental model — one that explains why Spark behaves the way it does, where performance bottlenecks come from, and how higher-level tools are ultimately executed across a cluster.</p><p>By the end of this article, you should be able to trace a Spark job from your code to the cluster, understand how Spark plans and schedules work, and reason about what is happening when things go wrong.</p><h4>WHY IT WAS BUILT THIS WAY</h4><p>Apache Spark did not appear in a vacuum. Its architecture is a direct response to the systems that came before it, most notably Hadoop MapReduce.</p><p>MapReduce was a breakthrough for large-scale batch processing, but it was also rigid in its approach. MapReduce was designed primarily for offline, batch processing. MapReduce is also disk-bound; it writes intermediate processing results to disk after each map and reduce step. Complex pipelines are expressed as long chains of separate jobs. This made iterative algorithms, interactive queries, and multi-step workflows slow and operationally heavy.</p><p>Spark was designed to remove these constraints.</p><p>Instead of being a single programming model, Spark was built as a general execution engine. Its core goals were:</p><ul><li><strong>In-memory computation</strong> to avoid unnecessary disk I/O</li><li><strong>Support for iterative and interactive workloads</strong></li><li><strong>A unified engine</strong> capable of powering batch processing, streaming, machine learning, and graph workloads</li><li><strong>Fault tolerance without replication</strong>, using lineage rather than data duplication</li></ul><p>These goals shaped Spark’s most important architectural choices. Rather than materializing every step to disk, Spark keeps intermediate data in memory whenever possible. Rather than forcing developers into a fixed model, Spark represents computation as a flexible directed graph. And rather than relying on replicated storage for recovery, Spark records how data was derived, allowing lost partitions to be recomputed when failures occur.</p><p>This is why Spark is often misunderstood when it is described as “faster MapReduce.” Spark is not a faster implementation of the same idea. It is a different execution model entirely, one that treats distributed computation as a continuously evolving graph of transformations, not a sequence of isolated jobs.</p><p>Understanding that intent makes Spark’s architecture much easier to reason about.</p><h4>HIGH LEVEL SPARK ARCHITECTURE</h4><p><strong>The Distributed Anatomy of a Spark Application</strong></p><p>Every Spark application, regardless of whether it runs on your laptop or a thousand-node cluster, follows the same architectural pattern. At a high level, a park application consists of three major components:</p><ul><li>A <strong>driver process</strong></li><li>A set of <strong>executor processes</strong></li><li>A <strong>cluster manager</strong></li></ul><p>Each plays a distinct role in turning your code into a running distributed computation.</p><h4><strong>The Driver: the brain of the application</strong></h4><p>The driver is where your Spark application begins. It maintains the application’s lifecycle, scheduling tasks, and managing job execution across the cluster. It runs your main function, creates theSparkSession, and executes the code that defines your transformations and actions.</p><p>But the driver’s most important responsibilities are not computational; they are orchestration and planning:</p><ul><li>It converts your code into a logical execution plan</li><li>It builds the DAG representing the job’s lineage</li><li>It splits that DAG into stages</li><li>It schedules tasks onto executors</li><li>It tracks progress and handles failures</li></ul><p>The driver does not process your full dataset. Instead, it coordinates the work, maintains metadata about distributed data, and acts as the control plane for the entire application.</p><p>If the driver fails, the application fails.</p><h4>Executors: the distributed workers</h4><p>Executors are long-lived JVM(Java Virtual Machine<strong>) </strong>processes launched on worker nodes. They are responsible for:</p><ul><li>Executing tasks</li><li>Storing data in memory or on disk</li><li>Performing shuffles</li><li>Reporting results and metrics back to the driver</li></ul><p>Each executor is allocated a certain number of CPU cores and a fixed memory budget. Tasks run in parallel within an executor, sharing its resources. Executors also handle data exchange between nodes, facilitating distributed data processing. They regularly report the status of their tasks to the driver, helping it track progress and handle faults or stragglers. Efficient executor management optimizes resource utilization and speeds up job execution.</p><p>From Spark’s perspective, executors are the physical machinery of computation. All actual data processing, reading, filtering, aggregating, and joining happen here.</p><h4>The cluster manager</h4><p>The cluster manager is responsible for allocating resources. It does not understand Spark jobs, stages, or transformations. It simply launches and monitors processes on behalf of the driver.</p><p>It interacts with the driver to manage node allocation, task scheduling, and resource distribution across the cluster. Popular cluster managers include Apache YARN, Mesos, and Kubernetes.</p><p>Once executors are started, Spark largely communicates with them directly. The cluster manager fades into the background.</p><h4>Jobs, stages, and tasks</h4><p>Spark structures execution into three nested levels:</p><ul><li>A <strong>job</strong> is triggered by an action (such as count, collect, or write).</li><li>A job is divided into <strong>stages</strong>, based on shuffle boundaries.</li><li>Each stage is executed as many <strong>tasks</strong>, typically one per partition.</li></ul><p>Tasks are the smallest unit of work in Spark. They operate on individual partitions of data and are scheduled across executors.</p><p>This hierarchy — jobs, stages, tasks is the runtime expression of Spark’s internal execution model. It is also the lens through which you will interpret nearly every performance issue using the Spark UI.</p><h3>FROM CODE TO CLUSTER</h3><p><strong>How Spark Executes Work</strong></p><p>Spark’s programming model is deliberately deceptive. You write what appears to be straightforward, sequential code. But Spark does not immediately execute most of what you write.</p><p>Instead, Spark builds a plan.</p><h4>Lazy Evaluation</h4><p>When you define a transformation, Saprk does not run it; it records it. Each transformation extends a lineage of operations that describe how new datasets are derived from existing ones.</p><p>Execution only begins when you call an <strong>action; </strong>an operation that requires a concrete result, such as writing data, counting rows, or collecting output.</p><p>At that moment, Spark takes the full lineage and constructs a logical execution graph.</p><h4>Transformations, actions, and job creation</h4><p>An action<em> </em>triggers the creation of a <strong>job</strong>. Spark analyzes the lineage, determines which data must be read, which transformations must be applied, and how results must be produced.</p><p>A transformation is a method on a dataframe that returns another <em>dataframe, </em>such as map, filter, or select.</p><p>If your application contains multiple actions, it may create multiple jobs, even if they operate on the same base data.</p><p>This is a crucial point: Spark does not execute “your program”; it executes jobs derived from your program.</p><h4>DAG construction and stage generation</h4><p>From the recorded lineage, Spark builds a <strong>Directed Acyclic Graph (DAG)</strong> representing the full computation. This graph captures:</p><ul><li>The sequence of transformations</li><li>The dependencies between datasets</li><li>Where data can be pipelined</li><li>Where data must be redistributed</li></ul><p>Spark then analyzes the DAG to find <strong>shuffle boundaries</strong>. These boundaries split the graph into stages. Each stage consists of transformations that can be executed without redistributing data across the network.</p><p>Every time data must move between executors based on keys or partitions, a new stage is created.</p><p>This is where performance behavior is defined.</p><h4>Task scheduling and execution</h4><p>Once stages are identified, Spark generates tasks. Each task processes one partition of data for a specific stage.</p><p>The driver schedules these tasks onto available executor slots. Executors pull tasks, execute them, write shuffle data when needed, and return status updates to the driver.</p><p>If an executor fails, Spark reschedules the lost tasks elsewhere. If cached data is lost, Spark recomputes it using lineage.</p><p>Fault tolerance is not an add-on feature in Spark. It is a natural consequence of this execution model.</p><h4>The execution loop</h4><p>From Spark’s perspective, all computation reduces to a repeating cycle:</p><ol><li>Build a DAG from lineage</li><li>Split it into stages</li><li>Generate tasks per partition</li><li>Schedule tasks onto executors</li><li>Monitor, retry, and complete</li></ol><p>Everything else in Spark, from DataFrames to streaming to machine learning, ultimately compiles down to this same engine.</p><h3>RDDs — THE FOUNDATION OF SPARK</h3><p><strong>Why They Existed, and Why They Still Matter</strong></p><p>At the heart of Spark’s original design is the Resilient Distributed Dataset, or RDD. Although most modern Spark code uses DataFrames or SQL, RDDs remain the conceptual foundation of Spark’s execution engine. Understanding them clarifies why Spark behaves the way it does, even when you never write sc.parallelize yourself.</p><p>An RDD is, at its core, an immutable, distributed collection of records, partitioned across executors. Each RDD knows:</p><ul><li>How it was created</li><li>How it is partitioned</li><li>RDDs it depends on</li></ul><p>This metadata is what allows Spark to coordinate computation and recover from failures.</p><h4>Immutability and partitioning</h4><p>RDDs are immutable. Once created, they never change. Every transformation produces a new RDD that references its parent.</p><p>This may seem restrictive, but it is essential. Immutability allows Spark to safely share datasets across tasks, pipeline transformations, and recompute lost data deterministically.</p><p>Each RDD is split into partitions. These partitions are the unit of parallelism in Spark. When a stage runs, Spark typically launches one task per partition. If an RDD has 200 partitions, up to 200 tasks can be executed in parallel.</p><p>Partitioning is not an implementation detail. It directly controls parallelism, memory usage, and shuffle behavior, themes you will see repeatedly in real Spark workloads.</p><h4>Lineage and fault tolerance</h4><p>RDDs are “resilient” because they track lineage.</p><p>Rather than replicating data across the cluster, Spark remembers how each RDD was derived from previous ones. If a partition is lost because an executor fails, Spark can reconstruct it by replaying the transformations that created it.</p><p>This lineage graph is what the driver uses to build the DAG you see in the Spark UI. It is also why Spark can recover from failures automatically, without checkpointing every intermediate result.</p><p>Fault tolerance in Spark is not achieved by storing extra copies of data. It is achieved by remembering how to recompute it.</p><h4>Transformations, actions, and dependencies</h4><p>RDD operations fall into two broad categories:</p><ul><li><strong>Transformations</strong>, which define new RDDs</li><li><strong>Actions</strong>, which request a concrete result</li></ul><p>Transformations are lazy. They extend the lineage. Actions trigger execution.</p><p>Under the hood, Spark also classifies RDD dependencies into two important types:</p><ul><li><strong>Narrow dependencies</strong>, where each child partition depends on a small number of parent partitions (such as map or filter)</li><li><strong>Wide dependencies</strong>, where child partitions depend on many parent partitions (such as groupByKey or join)</li></ul><p>Wide dependencies require data to be redistributed across the cluster. They introduce shuffles. They create stage boundaries. They dominate performance.</p><p>This distinction, narrow versus wide, is one of the most important ideas in all of Spark.</p><h4>Persistence and checkpointing</h4><p>RDDs can be persisted in memory or on disk. When an RDD is cached, Spark stores its partitions on executors after they are computed, allowing future actions to reuse them.</p><p>Caching changes execution. It shortens lineage chains, reduces recomputation, and can dramatically improve performance, or completely destabilize a job if memory is mismanaged.</p><p>Checkpointing, by contrast, truncates lineage by writing RDDs to reliable storage. It is used when lineage becomes very long or when recomputation would be prohibitively expensive.</p><p>Both mechanisms exist because RDDs are defined by lineage rather than materialization.</p><h4>Why RDDs still matter</h4><p>Today, most Spark workloads are written with DataFrames and SQL. But RDDs still matter in several ways:</p><ul><li>They are the <strong>conceptual model</strong> underlying Spark’s execution engine</li><li>They appear in low-level integrations and custom processing</li><li>They are still used for unstructured data and fine-grained control</li><li>Their lineage model drives fault tolerance for all higher-level APIs</li></ul><p>You do not need to write RDD code to think in RDD terms. When you reason about partitions, dependencies, shuffles, or recomputation, you are reasoning in the language of RDDs.</p><h3>THE DAG —SPARK’S EXECUTION BLUEPRINT</h3><p><strong>How Spark Plans Distributed Computation</strong></p><p>Every Spark job is ultimately executed as a Directed Acyclic Graph, or DAG. This graph is not a visualization feature. It is Spark’s internal representation of your computation.</p><p>It is the bridge between the code you write and the tasks that run across the cluster.</p><p>Each node in the DAG represents a logical dataset. Each edge represents a transformation. Together, they form a blueprint that Spark analyzes before executing any work.</p><p>This graph is built on the driver, based on the RDD lineage (or the logical plan generated from DataFrames and SQL).</p><h3>Logical graphs and physical execution</h3><p>The initial DAG is logical. It describes what must happen, not how it will happen.</p><p>Spark then analyzes this graph to decide:</p><ul><li>Where stages must be separated</li><li>How tasks can be parallelized</li><li>Where shuffles must occur</li><li>How failures can be recovered</li></ul><p>Only after this analysis does Spark generate physical tasks and schedule them on executors.</p><p>The DAG you see in the Spark UI is the shadow of this planning process.</p><h4>Stage boundaries and shuffles</h4><p>Spark splits the DAG into stages at shuffle boundaries.</p><p>Within a stage, transformations can be pipelined. Data flows through multiple operations without being written to disk or redistributed across the cluster.</p><p>Between stages, data must be reorganized. Partitions are written, transferred, merged, and read. These are the most expensive moments in most Spark jobs.</p><p>Every stage boundary is the result of a wide dependency.</p><p>This is why understanding the DAG is inseparable from understanding performance.</p><h4>The DAG as a performance model</h4><p>Once you can mentally sketch the DAG of a Spark job, many behaviors become predictable:</p><ul><li>Why some jobs start instantly, while others pause</li><li>Why adding a groupBy changes everything</li><li>Why some failures are cheap and others catastrophic</li><li>Why caching in one place helps, and in another does nothing</li></ul><p>The DAG is not just how Spark executes work. It is how Spark explains itself.</p><h4>Seeing the DAG</h4><p>The Spark UI exposes the DAG for every job. It shows stages, dependencies, and shuffle boundaries. It is the single most important debugging and learning tool Spark provides.</p><p>The UI does not show your code. It shows Spark’s interpretation of your code.</p><p>Learning to read it is learning to speak Spark’s internal language.</p><h4>A foundation for everything else</h4><p>DataFrames, SQL, streaming queries, and machine learning pipelines all compile down to the same internal model. Different APIs, same engine. Different abstractions, same DAG.</p><p>This is why Spark can unify such diverse workloads. And it is why mastering the DAG unlocks everything that follows.</p><h3>WHAT THIS MENTAL MODEL CHANGES</h3><p>By now, you understand Spark’s architecture, the role of RDDs, and the DAG that drives execution. But why does this matter for you as a Spark developer?</p><p>Understanding these foundations transforms how you reason about your jobs.</p><h4>Predicting Shuffles</h4><p>Shuffles — the redistribution of data across partitions — are the most expensive operations in Spark. By knowing:</p><ul><li>Which transformations produce <strong>wide dependencies</strong>, and</li><li>Where stage boundaries appear in the DAG</li></ul><p>You can anticipate when and where shuffles will occur. This allows you to:</p><ul><li>Avoid unnecessary shuffles</li><li>Repartition strategically</li><li>Debug performance issues before they become critical</li></ul><p>Without a DAG-oriented mindset, shuffles appear mysterious and unpredictable. With it, they are logical and manageable.</p><h4>Understanding Slow Jobs</h4><p>Have you ever wondered why a simple groupByKey can bring a Spark job to a crawl?</p><p>By mapping operations to stages and understanding partitioning, you can:</p><ul><li>Identify bottleneck stages</li><li>See which transformations are narrow or wide</li><li>Determine whether caching or broadcasting variables will help</li></ul><p>This predictive power turns Spark from a “black box” into a system you can reason about.</p><h4>Debugging Failures</h4><p>Executor failures, lost partitions, or out-of-memory errors often leave beginners confused. But if you understand RDD lineage and DAG execution:</p><ul><li>You know why Spark can recompute lost data automatically</li><li>You can pinpoint which stage is responsible for the failure</li><li>You can make targeted adjustments to memory, caching, or partitions</li></ul><p>Failure is no longer random. It becomes a solvable system problem.</p><h3>Writing Scalable Pipelines</h3><p>Finally, this mental model informs design choices:</p><ul><li>When to cache intermediate datasets</li><li>When to use narrow transformations over wide ones</li><li>How many partitions to create for optimal parallelism</li><li>When low-level RDD APIs are actually appropriate</li></ul><p>Even if your production code uses DataFrames or SQL, all decisions trace back to the same execution engine.</p><h3>KEY TAKEAWAYS</h3><p>Let’s summarize what you should carry forward from Part 1:</p><ol><li><strong>Spark is an execution engine, not just an API.</strong><br> Your code triggers jobs that the engine plans and executes.</li><li><strong>RDDs are the conceptual foundation.</strong><br> They introduce immutability, lineage, partitioning, and fault tolerance.</li><li><strong>The DAG drives execution and performance.</strong><br> Understanding stage boundaries, narrow vs wide dependencies, and shuffles explains why jobs succeed, fail, or lag.</li><li><strong>Mental models matter more than memorizing APIs.</strong><br> With a clear view of architecture, RDDs, and the DAG, you can reason about correctness, scalability, and performance.</li></ol><h3>WHAT’S NEXT</h3><p>This part has grounded you in the engine beneath all of Spark. You now know:</p><ul><li>How the driver, executors, and cluster manager interact</li><li>How RDDs provide lineage and fault tolerance</li><li>How the DAG maps your transformations into stages and tasks</li></ul><p>In <em>Part 2</em>, we will <strong>move up the stack</strong> to the modern Spark APIs:</p><ul><li><strong>DataFrames and Datasets</strong> for declarative, high-level programming</li><li><strong>Spark SQL</strong> and the Catalyst optimizer</li><li>How these modern layers still rely on the RDD-based DAG you just mastered</li></ul><p>With the foundation from<em> Part 1</em>, understanding these APIs will be intuitive. You’ll see not just <em>how</em> to use DataFrames, but <em>why they are so fast</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f426cfd6d71" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>