<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kathir</title>
    <description>The latest articles on DEV Community by Kathir (@kathir_2911).</description>
    <link>https://dev.to/kathir_2911</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3419960%2F65777535-391c-4346-8c5a-9b269c651d55.png</url>
      <title>DEV Community: Kathir</title>
      <link>https://dev.to/kathir_2911</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kathir_2911"/>
    <language>en</language>
    <item>
      <title>Day 1: Understanding MySQL Storage Engines and MVCC</title>
      <dc:creator>Kathir</dc:creator>
      <pubDate>Mon, 06 Jul 2026 16:05:49 +0000</pubDate>
      <link>https://dev.to/kathir_2911/day-1-understanding-mysql-storage-engines-and-mvcc-29ea</link>
      <guid>https://dev.to/kathir_2911/day-1-understanding-mysql-storage-engines-and-mvcc-29ea</guid>
      <description>&lt;h2&gt;
  
  
  📚 Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is InnoDB?&lt;/li&gt;
&lt;li&gt;What is a Storage Engine?&lt;/li&gt;
&lt;li&gt;MySQL Server Architecture&lt;/li&gt;
&lt;li&gt;
MySQL Storage Engines

&lt;ul&gt;
&lt;li&gt;InnoDB&lt;/li&gt;
&lt;li&gt;MyISAM&lt;/li&gt;
&lt;li&gt;MEMORY Engine&lt;/li&gt;
&lt;li&gt;CSV Engine&lt;/li&gt;
&lt;li&gt;ARCHIVE Engine&lt;/li&gt;
&lt;li&gt;NDB Cluster&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;NDB Cluster Architecture&lt;/li&gt;
&lt;li&gt;Advantages of NDB Cluster&lt;/li&gt;
&lt;li&gt;Disadvantages of NDB Cluster&lt;/li&gt;
&lt;li&gt;Real World Use Cases&lt;/li&gt;
&lt;li&gt;RAM + Disk Checkpoints&lt;/li&gt;
&lt;li&gt;Example Hardware Requirement&lt;/li&gt;
&lt;li&gt;Can SQL Node and Management Node be on the Same Machine?&lt;/li&gt;
&lt;li&gt;MVCC (Multi-Version Concurrency Control)&lt;/li&gt;
&lt;li&gt;Why is MVCC Needed?&lt;/li&gt;
&lt;li&gt;Benefits of MVCC&lt;/li&gt;
&lt;li&gt;How MySQL Implements MVCC&lt;/li&gt;
&lt;li&gt;What Happens When a Row is Updated?&lt;/li&gt;
&lt;li&gt;Hidden Columns in Every InnoDB Row&lt;/li&gt;
&lt;li&gt;Read View&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When learning MySQL, one of the first concepts you should understand is the &lt;strong&gt;Storage Engine&lt;/strong&gt;. A storage engine determines how MySQL stores, retrieves, and manages data. Different storage engines are designed for different workloads, such as transaction processing, read-heavy applications, temporary data storage, historical data, and distributed databases.&lt;/p&gt;

&lt;p&gt;In this blog, I'll be covering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is a Storage Engine?&lt;/li&gt;
&lt;li&gt;Different MySQL Storage Engines&lt;/li&gt;
&lt;li&gt;InnoDB&lt;/li&gt;
&lt;li&gt;MyISAM&lt;/li&gt;
&lt;li&gt;MEMORY Engine&lt;/li&gt;
&lt;li&gt;CSV Engine&lt;/li&gt;
&lt;li&gt;ARCHIVE Engine&lt;/li&gt;
&lt;li&gt;NDB Cluster&lt;/li&gt;
&lt;li&gt;MVCC (Multi-Version Concurrency Control)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What is InnoDB?
&lt;/h2&gt;

&lt;p&gt;InnoDB is a default storage engine in MySQL. Think of it as the component that decides how your data is stored on disk and how it is managed.&lt;/p&gt;

&lt;p&gt;Without a storage engine, MySQL wouldn't know how to physically store or retrieve your data.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a Storage Engine?
&lt;/h2&gt;

&lt;p&gt;A storage engine is the software component of a database management system responsible for how data is physically stored, retrieved, indexed and managed. It also controls features such as transactions, concurrency, crash recovery, and data access methods.&lt;/p&gt;

&lt;p&gt;A storage engine is software inside MySQL responsible for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Storing data on disk&lt;/li&gt;
&lt;li&gt;Retrieving data&lt;/li&gt;
&lt;li&gt;Managing indexes&lt;/li&gt;
&lt;li&gt;Handling transactions&lt;/li&gt;
&lt;li&gt;Recovering from crashes&lt;/li&gt;
&lt;li&gt;Controlling concurrent access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Storage Engine =&lt;/strong&gt; The internal component that stores and manages data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database =&lt;/strong&gt; The complete software (MySQL, PostgreSQL, MongoDB, etc.)&lt;/p&gt;

&lt;p&gt;Not every database supports multiple storage engines like MySQL does. Many databases have one built-in storage engine.&lt;/p&gt;




&lt;h2&gt;
  
  
  MySQL Server Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MySQL Server
│
├── SQL Engine
│
└── Data Storage (Storage Engines)
     │
     ├── InnoDB
     ├── MyISAM
     ├── MEMORY
     ├── CSV
     ├── ARCHIVE
     └── NDB Cluster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;MySQL Server = SQL Engine + Data Storage&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  MySQL Storage Engines
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. InnoDB
&lt;/h2&gt;

&lt;p&gt;InnoDB =&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Foreign keys&lt;/li&gt;
&lt;li&gt;Crash recovery&lt;/li&gt;
&lt;li&gt;Transactions&lt;/li&gt;
&lt;li&gt;ACID&lt;/li&gt;
&lt;li&gt;Row locking&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Banking&lt;/li&gt;
&lt;li&gt;E-commerce&lt;/li&gt;
&lt;li&gt;ERP&lt;/li&gt;
&lt;li&gt;Inventory systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;InnoBase Development =&amp;gt; Full form&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  2. MyISAM
&lt;/h2&gt;

&lt;p&gt;MyISAM&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does not support Transactions&lt;/li&gt;
&lt;li&gt;Does not support Foreign Keys&lt;/li&gt;
&lt;li&gt;Supports only Table Locking (not Row Locking)&lt;/li&gt;
&lt;li&gt;Limited Crash Recovery&lt;/li&gt;
&lt;li&gt;Often faster for simple read-only workloads&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read-heavy applications&lt;/li&gt;
&lt;li&gt;Old web applications&lt;/li&gt;
&lt;li&gt;Static databases with frequent SELECT queries but very few updates or deletes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is lightweight.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full form&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;MySQL Indexed Sequential Access Method engine, created by adding indexing and improvements for MySQL.&lt;/p&gt;

&lt;p&gt;Unlike other engines, a MyISAM table is stored on your disk as three separate files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.frm&lt;/code&gt; : Stores the table definition&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.MYD&lt;/code&gt; : Stores the actual MY data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.MYI&lt;/code&gt; : Stores the MY index&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It was the default storage engine for the MySQL relational database management system versions prior to 5.5 released in December 2009.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. MEMORY Engine
&lt;/h2&gt;

&lt;p&gt;Everything is stored in RAM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Extremely fast&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Data disappears when MySQL restarts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Formerly known as Heap.&lt;/p&gt;

&lt;p&gt;Creates special-purpose tables with contents that are stored in memory.&lt;/p&gt;

&lt;p&gt;Because the data is vulnerable to crashes, hardware issues, or power outages, only use these tables as temporary work areas or read-only caches for data pulled from other tables.&lt;/p&gt;

&lt;p&gt;Normally, MySQL stores tables on the hard disk, but for MEMORY the table is stored only in RAM.&lt;/p&gt;

&lt;p&gt;MEMORY is used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sessions&lt;/li&gt;
&lt;li&gt;Cache&lt;/li&gt;
&lt;li&gt;OTPs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if MySQL uses RAM it doesn't work like Redis.&lt;/p&gt;

&lt;p&gt;MySQL has to read the entire query and has to follow the pipeline even if it is present in memory, but Redis is like a hash table which gives the output.&lt;/p&gt;

&lt;p&gt;Even if session and cache may be worked with MEMORY, it is best to use Redis for it.&lt;/p&gt;

&lt;p&gt;MEMORY tables cannot be partitioned.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. CSV Engine
&lt;/h2&gt;

&lt;p&gt;Stores table as a CSV file.&lt;/p&gt;

&lt;p&gt;Useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exporting&lt;/li&gt;
&lt;li&gt;Data exchange&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you create a CSV table, the server creates a plain text data file having a name that begins with the table name and has a &lt;code&gt;.CSV&lt;/code&gt; extension.&lt;/p&gt;

&lt;p&gt;When you store data into the table, the storage engine saves it into the data file in comma-separated values format.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. ARCHIVE Engine
&lt;/h2&gt;

&lt;p&gt;Designed for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Historical records&lt;/li&gt;
&lt;li&gt;Log storage&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;High compression&lt;/li&gt;
&lt;li&gt;Saves disk space&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Limitations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Doesn't support UPDATE&lt;/li&gt;
&lt;li&gt;Doesn't support DELETE&lt;/li&gt;
&lt;li&gt;Doesn't support Transactions&lt;/li&gt;
&lt;li&gt;Doesn't support MVCC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Designed for storing large amounts of historical data that is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rarely modified&lt;/li&gt;
&lt;li&gt;Mostly inserted&lt;/li&gt;
&lt;li&gt;Occasionally queried&lt;/li&gt;
&lt;li&gt;Highly compressible&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Audit logs&lt;/li&gt;
&lt;li&gt;Login history&lt;/li&gt;
&lt;li&gt;Sensor data&lt;/li&gt;
&lt;li&gt;Financial transaction history&lt;/li&gt;
&lt;li&gt;IoT event logs&lt;/li&gt;
&lt;li&gt;Web server logs&lt;/li&gt;
&lt;li&gt;Old application events&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These records are usually never updated.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. NDB Cluster
&lt;/h2&gt;

&lt;p&gt;NDB Cluster (Network Database Cluster Engine)&lt;/p&gt;

&lt;p&gt;It is a MySQL storage engine designed for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High availability&lt;/li&gt;
&lt;li&gt;Fault tolerance&lt;/li&gt;
&lt;li&gt;Distributed databases&lt;/li&gt;
&lt;li&gt;In-memory processing&lt;/li&gt;
&lt;li&gt;Automated replication&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unlike InnoDB, which stores data on a single MySQL server, NDB stores data across multiple machines (nodes).&lt;/p&gt;

&lt;p&gt;Used for applications like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Banking&lt;/li&gt;
&lt;li&gt;Telecom&lt;/li&gt;
&lt;li&gt;Stock Exchanges&lt;/li&gt;
&lt;li&gt;Airline Reservations&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  NDB Cluster Architecture
&lt;/h2&gt;

&lt;p&gt;NDB Cluster consists of three node types.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Management Node (MGM)
&lt;/h2&gt;

&lt;p&gt;Think of it as the manager.&lt;/p&gt;

&lt;p&gt;Responsibilities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Starts the cluster&lt;/li&gt;
&lt;li&gt;Stops the cluster&lt;/li&gt;
&lt;li&gt;Stores configuration&lt;/li&gt;
&lt;li&gt;Monitors health&lt;/li&gt;
&lt;li&gt;Coordinates nodes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It does not store application data.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Data Node
&lt;/h2&gt;

&lt;p&gt;They store:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rows&lt;/li&gt;
&lt;li&gt;Indexes&lt;/li&gt;
&lt;li&gt;Fragments&lt;/li&gt;
&lt;li&gt;Replicas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Usually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node A&lt;/li&gt;
&lt;li&gt;Node B&lt;/li&gt;
&lt;li&gt;Node C&lt;/li&gt;
&lt;li&gt;Node D&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data is spread across them.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. SQL Nodes
&lt;/h2&gt;

&lt;p&gt;These are normal MySQL servers.&lt;/p&gt;

&lt;p&gt;Applications connect here.&lt;/p&gt;

&lt;p&gt;In NDB, the SQL server doesn't actually store the data.&lt;/p&gt;

&lt;p&gt;It acts like a gateway.&lt;/p&gt;




&lt;h2&gt;
  
  
  Advantages of NDB Cluster
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;High availability&lt;/li&gt;
&lt;li&gt;Automatic replication&lt;/li&gt;
&lt;li&gt;Distributed&lt;/li&gt;
&lt;li&gt;Very Fast Reads&lt;/li&gt;
&lt;li&gt;Fault Tolerance&lt;/li&gt;
&lt;li&gt;Scalability&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Disadvantages of NDB Cluster
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;More complex to configure&lt;/li&gt;
&lt;li&gt;Requires more RAM&lt;/li&gt;
&lt;li&gt;Higher hardware costs&lt;/li&gt;
&lt;li&gt;Not commonly used as InnoDB&lt;/li&gt;
&lt;li&gt;Some SQL features and performance characteristics differ from InnoDB, so application compatibility should be evaluated.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Real World Use Cases
&lt;/h2&gt;

&lt;p&gt;Commonly used in systems that require continuous availability and low latency, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Telecommunications subscriber databases&lt;/li&gt;
&lt;li&gt;Real-time billing systems&lt;/li&gt;
&lt;li&gt;Online gaming backends&lt;/li&gt;
&lt;li&gt;Financial trading platforms&lt;/li&gt;
&lt;li&gt;Airline reservation systems&lt;/li&gt;
&lt;li&gt;Large scale authentication services&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  RAM + Disk Checkpoints
&lt;/h2&gt;

&lt;p&gt;NDB uses RAM + Disk checkpoints.&lt;/p&gt;

&lt;p&gt;In NDB, data is primarily stored in RAM for very fast access.&lt;/p&gt;

&lt;p&gt;If data were stored only in RAM, then after a power failure data would be lost.&lt;/p&gt;

&lt;p&gt;That would be just like the MySQL MEMORY engine.&lt;/p&gt;

&lt;p&gt;To prevent this, NDB periodically creates checkpoints.&lt;/p&gt;

&lt;p&gt;A checkpoint is simply a snapshot of the current data written from RAM to disk.&lt;/p&gt;

&lt;p&gt;Think of it as pressing &lt;strong&gt;Save&lt;/strong&gt; in Microsoft Word and when saved it on disk.&lt;/p&gt;




&lt;h2&gt;
  
  
  Example Hardware Requirement
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Management Node
&lt;/h2&gt;

&lt;p&gt;Machine 1 = Management Server&lt;/p&gt;

&lt;p&gt;It does configuration only.&lt;/p&gt;

&lt;p&gt;Very little RAM required.&lt;/p&gt;

&lt;p&gt;Typically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 CPU&lt;/li&gt;
&lt;li&gt;1–2 GB RAM&lt;/li&gt;
&lt;li&gt;10 GB Disk&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  First Data Node
&lt;/h2&gt;

&lt;p&gt;Machine 2 = Stores Data&lt;/p&gt;

&lt;p&gt;Needs much more RAM.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;4 CPU Cores&lt;/li&gt;
&lt;li&gt;16 GB RAM&lt;/li&gt;
&lt;li&gt;SSD&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Second Data Node
&lt;/h2&gt;

&lt;p&gt;Machine 3 = Replica&lt;/p&gt;

&lt;p&gt;Same specifications as the first data node.&lt;/p&gt;




&lt;h2&gt;
  
  
  Can SQL Node and Management Node be on the Same Machine?
&lt;/h2&gt;

&lt;p&gt;Yes.&lt;/p&gt;

&lt;p&gt;For development or testing, you can run:&lt;/p&gt;

&lt;p&gt;Machine 1&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Management Node&lt;/li&gt;
&lt;li&gt;SQL Node&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Machine 2&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Node&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Machine 3&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Node&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  MVCC (Multi-Version Concurrency Control)
&lt;/h2&gt;

&lt;p&gt;MVCC (Multi-Version Concurrency Control) is a database concurrency mechanism that allows multiple transactions to access the same data simultaneously without blocking each other.&lt;/p&gt;

&lt;p&gt;Instead of overwriting data immediately, the database keeps multiple versions of a row.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why is MVCC Needed?
&lt;/h2&gt;

&lt;p&gt;Imagine two users.&lt;/p&gt;

&lt;p&gt;Transaction A is reading a customer's balance.&lt;/p&gt;

&lt;p&gt;Transaction B is updating that balance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Without MVCC
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A might have to wait until B finishes (locking), reducing concurrency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  With MVCC
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A reads the old version of the row.&lt;/li&gt;
&lt;li&gt;B writes a new version of the row.&lt;/li&gt;
&lt;li&gt;Both proceed without blocking each other.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Benefits of MVCC
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Readers don't block writes.&lt;/li&gt;
&lt;li&gt;Writes don't block readers.&lt;/li&gt;
&lt;li&gt;High concurrency.&lt;/li&gt;
&lt;li&gt;Consistent snapshots for transactions.&lt;/li&gt;
&lt;li&gt;Fewer lock conflicts.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How MySQL Implements MVCC
&lt;/h2&gt;

&lt;p&gt;MySQL uses Undo Logs to reconstruct older versions of rows.&lt;/p&gt;

&lt;p&gt;Each transaction reads the appropriate version based on its snapshot.&lt;/p&gt;

&lt;p&gt;MVCC is implemented by the MySQL storage engine using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Undo Logs&lt;/li&gt;
&lt;li&gt;Transaction IDs&lt;/li&gt;
&lt;li&gt;Read Views (Snapshots)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Happens When a Row is Updated?
&lt;/h2&gt;

&lt;p&gt;When a row is updated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The new value goes to the data page (in memory first).&lt;/li&gt;
&lt;li&gt;The old value is copied into the Undo Log.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MVCC uses the Undo Log to reconstruct old versions for transactions that started earlier.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Columns in Every InnoDB Row
&lt;/h2&gt;

&lt;p&gt;Every InnoDB row has hidden columns.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;DB_TRX_ID&lt;/strong&gt; = Transaction that last modified the row.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DB_ROLL_PTR&lt;/strong&gt; = Pointer to Undo Log.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DB_ROW_ID&lt;/strong&gt; = Internal row ID (if no Primary Key).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The user never sees them.&lt;/p&gt;




&lt;h2&gt;
  
  
  Read View
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Read View = Snapshot&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Today, I learned about MySQL Storage Engines and MVCC. I explored the purpose of storage engines, the characteristics of different MySQL storage engines, the architecture of NDB Cluster, and how MVCC enables high concurrency by maintaining multiple versions of rows. These concepts form the foundation for understanding how MySQL manages data efficiently and reliably.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Polling and Events</title>
      <dc:creator>Kathir</dc:creator>
      <pubDate>Tue, 23 Jun 2026 03:09:09 +0000</pubDate>
      <link>https://dev.to/kathir_2911/polling-and-events-60n</link>
      <guid>https://dev.to/kathir_2911/polling-and-events-60n</guid>
      <description>&lt;h2&gt;
  
  
  Short Polling and Long Polling
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Short Polling&lt;/strong&gt; &lt;br&gt;
Short polling is a technique where the client repeatedly sends HTTP requests at fixed intervals, and the server responds immediately whether or not new data is available.  It doesn't wait for the results, and the result can be generated between any iteration of request response. The waiting time of request and response were assigned by the client or server.&lt;/p&gt;

&lt;p&gt;Request data:&lt;br&gt;
 Client---------&amp;gt;Server&lt;br&gt;
              Client&amp;lt;---------Server (No Data)&lt;br&gt;
              Client---------&amp;gt;Server&lt;br&gt;
              Client&amp;lt;---------Server (No Data)       &lt;/p&gt;

&lt;p&gt;Iteration continuous until data is available&lt;br&gt;
              Client---------&amp;gt;Server&lt;br&gt;
              Client&amp;lt;---------Server (Sent Data)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Long Polling&lt;/strong&gt;&lt;br&gt;
Long polling is a type of HTTP request where the request is sent by the client to the server, and the connection is open until the result is generated. Only when the proper result generates, the server sent the response to client.&lt;/p&gt;

&lt;p&gt;Request data: &lt;br&gt;
Client----------&amp;gt;Server&lt;br&gt;
                Wait until data is available....&lt;br&gt;
              Client&amp;lt;----------Server (Sent data)&lt;/p&gt;

&lt;h2&gt;
  
  
  Event Stream
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Event Stream&lt;/strong&gt;&lt;br&gt;
Also known as Server-Sent Events (SSE). Example of Event Stream is "ChatGPT".  The server sent the response to the client continuously as the result generation is in progress and during that the time the connection between client and server is active. This prevents the client to wait for a huge amount of time until it completes a large process and sent the result.  A limitation of Event Stream is that browsers may restrict the number of simultaneous connections per domain.&lt;br&gt;
Example: Opening many ChatGPT tabs may slow your browser or consume more network resources, but this is not a limitation of Event Streams themselves. &lt;/p&gt;

&lt;p&gt;Request data: &lt;br&gt;
Client----------&amp;gt;Server&lt;/p&gt;

&lt;p&gt;Client&amp;lt;--------Server (Data until completed-Ex:10% completed data)&lt;br&gt;
Client&amp;lt;--------Server (Data until completed-30%)&lt;br&gt;
Client&amp;lt;--------Server (Data until completed-80%)&lt;br&gt;
Client&amp;lt;--------Server (Data until completed-100%)&lt;br&gt;
Connection closes&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
