惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
A
About on SuperTechFans
Vercel News
Vercel News
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
V
Visual Studio Blog
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
美团技术团队

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The Disk-Level Architecture of OLTP vs. OLAP
Samarth Gambhir · 2026-06-14 · via DEV Community

Every backend engineer has seen this happen, you build an application on a relational database like MySQL, handling thousands of concurrent transactions effortlessly. Then, the business asks for a real time analytics dashboard. But when you run an aggregation query over historical data, suddenly the database that effortlessly managed live traffic starts thrashing, evicting your working set, and dragging application performance down.

This isn't a tuning problem, a missing index, or a badly written query. It’s a fundamental architectural collision.

OLTP (Online Transaction Processing)

OLTP encompasses nearly every concurrent digital interaction triggered across a distributed system. A user downloading a PDF, a microservice firing an automatic maintenance log, a comment on a social feed these are all transactions.

Data engineers rely on OLTP systems (like MySQL or PostgreSQL) to capture these concurrent streams of interactions for creating, updating and deleting records.

The Tree Based In-Place Engine

To reliably capture massive volumes of transactions without corrupting data or locking up the application, OLTP systems rely on a highly optimized, row oriented architecture built around the B+ Tree.

Because they must provide immediate, atomic updates to existing records, transactional databases manage state through a strict sequence of physical tree traversal and in-memory page mutation:

  1. The B+ Tree Indexing: When a transaction reads or updates id: 1, the engine traverses a B+ Tree from the root, through the branch nodes, directly to the specific physical leaf node holding that row. This O(\log n) traversal guarantees a fast, isolated point-lookup. It ensures the application always hits the single version of the row without scanning irrelevant data.

  2. The Buffer Pool & In-Place Updates: OLTP systems perform in place updates. The database pulls the exact page containing id: 1 from the physical disk into memory (the Buffer Pool). The specific row is mutated directly in RAM and the page is marked as 'dirty'.

  3. Write-Ahead Logging (WAL): Because updating data in the Buffer Pool is volatile, the database must guarantee strict ACID durability. Before the dirty page is ever flushed back to the disk to overwrite the old contiguous block, the raw change event is appended to a sequential log (the WAL). Sequential disk writes are incredibly fast, guaranteeing that the transaction is permanently recorded without forcing the user to wait for a heavy disk overwrite.

This architecture makes relational databases the ultimate engine for ingesting millions of concurrent transactions safely. But the exact physical layout that makes it perfect for point updates is exactly what causes random I/O and memory spikes when you try to sequentially scan millions of those rows at once.

OLAP (Online Analytical Processing)

While OLTP is heavily optimized for real time state mutations, OLAP is engineered for multi-dimensional aggregation across historical datasets. Organizations today collect massive volumes of fragmented data across different sources like application databases, website clickstreams, and internal microservices.

Data engineers rely on OLAP systems (like StarRocks or data lakes built on Apache Iceberg) to unify these decoupled streams, executing complex aggregations, scans and joins to answer multi dimensional questions.

The Layer Based Append Only Engine

To solve the random I/O problem of the B-Tree, modern OLAP engines and data lakes (like StarRocks or Apache Iceberg) abandon in place updates entirely. Instead, they use a layered, append only architecture, heavily inspired by LSM-Trees (Log-Structured Merge-trees).

  1. The Ingestion Layer (Layer 0)
    When new data arrives or an update to an existing record occurs, the OLAP engine doesn't traverse a giant tree to find the old record. It simply writes the new record as a brand new, highly compressed Parquet or columnar file into the top layer of storage (Layer 0). This turns every write and update into a fast, sequential disk append. If id: 1 changes its status from "pending" to "active", the database doesn't overwrite the old "pending" row. It just drops a new file in Layer 0 saying id: 1 is now "active".

  2. The Read Path (Merge-on-Read)
    Because updates are just new inserts, there are technically duplicate records for id: 1 sitting on the disk. When an analytical query runs, the storage engine reads top-down. It checks the newest layers first. When it sees the "active" record in Layer 0, it dynamically masks or ignores the older "pending" record in the lower layers. The query gets the absolute latest state without ever having to traverse a massive tree structure.

  3. The Compaction Engine
    If the database only ever appended data, the disk would eventually explode with millions of tiny Parquet files, and read performance would degrade as the engine tried to merge too many layers on the fly. To handle this, background compaction run continuously. These async processes take the fragmented files from Layer 0 and merge them into larger, heavily optimized files in Layer 1. During this compaction process, the engine identifies the duplicates, physically drops the stale "pending" record for id: 1, and creates a single version of truth in the lower layer.

Bridging the Gap

If OLTP is strictly engineered for atomic writes and OLAP is optimized for massive reads, how do we get data from one to the other without destabilizing either system?

You don't do it by writing to both databases from your application, that introduces complexity and unacceptable latency. You also can't rely on heavy, periodic batch ETL jobs running directly against the transactional database without spiking resource usage and impacting live users.

The solution requires completely decoupling ingestion from analytics. In the modern data stack, this is achieved through Change Data Capture (CDC), streaming committed changes directly from the OLTP's Write-Ahead Log into the OLAP's append-only ingestion layer.

But the mechanics of how we safely stream, transform, and ingest those logs at scale without dropping events is an entirely different architectural deep-dive.