<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Storage-Engine on Mini Fish</title>
    <link>https://blog.minifish.org/tags/storage-engine/</link>
    <description>Recent content in Storage-Engine on Mini Fish</description>
    <image>
      <title>Mini Fish</title>
      <url>https://blog.minifish.org/android-chrome-512x512.png</url>
      <link>https://blog.minifish.org/android-chrome-512x512.png</link>
    </image>
    <generator>Hugo -- 0.161.1</generator>
    <language>en-US</language>
    <copyright>Mini Fish 2014-present. Licensed under CC-BY-NC</copyright>
    <lastBuildDate>Wed, 27 May 2026 09:00:00 +0800</lastBuildDate>
    <atom:link href="https://blog.minifish.org/tags/storage-engine/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>TegDB: Notes from Building a Small Embedded Database</title>
      <link>https://blog.minifish.org/posts/tegdb-embedded-database/</link>
      <pubDate>Wed, 27 May 2026 09:00:00 +0800</pubDate>
      <guid>https://blog.minifish.org/posts/tegdb-embedded-database/</guid>
      <description>A project note on TegDB, a lightweight embedded database engine with ACID transactions, WAL recovery, B&#43;tree indexing, and a SQL-like interface.</description>
      <content:encoded><![CDATA[<p>TegDB is a lightweight embedded database engine with a SQL-like interface. It is written in Rust and focuses on simplicity, reliability, and predictable behavior.</p>
<p>The project is not trying to compete with SQLite. It is a learning and systems-design project: what happens when you build the parts of a small database yourself?</p>
<h2 id="design-philosophy">Design philosophy</h2>
<p>The most important choice is simplicity. TegDB uses a deliberately constrained architecture:</p>
<ul>
<li>embedded engine</li>
<li>single-process access</li>
<li>write-ahead logging</li>
<li>crash recovery</li>
<li>B+tree-style indexing</li>
<li>schema and constraint checks</li>
<li>SQL-like query surface</li>
</ul>
<p>Avoiding broad concurrency is not a weakness for this kind of project. It reduces the number of failure modes and makes the storage path easier to reason about.</p>
<h2 id="why-build-a-database">Why build a database</h2>
<p>Database internals are easier to understand when you have to implement the boring parts:</p>
<ul>
<li>how records are serialized</li>
<li>how pages are found</li>
<li>how an index points to storage</li>
<li>when a transaction becomes durable</li>
<li>how recovery decides what to replay</li>
<li>how a query stops early with <code>LIMIT</code></li>
</ul>
<p>Reading database code is useful. Writing a small one makes the tradeoffs harder to ignore.</p>
<h2 id="reliability-work">Reliability work</h2>
<p>The most interesting code in a database is often not the happy path. TegDB spends attention on:</p>
<ul>
<li>write-ahead log commit markers</li>
<li>rollback behavior</li>
<li>partial write handling</li>
<li>file locking</li>
<li>recovery after crash</li>
<li>corruption boundaries</li>
</ul>
<p>These are the parts that turn “data structure on disk” into “database.”</p>
<h2 id="what-i-learned">What I learned</h2>
<p>The database abstraction is expensive because it hides many coordinated guarantees. Even a small embedded engine has to care about durability, serialization, schema behavior, query planning shortcuts, and operational failure.</p>
<p>The lesson is not that every app should have a custom database. The lesson is the opposite: after building even a small one, you gain more respect for mature storage engines.</p>
<h2 id="open-source-status">Open source status</h2>
<p>TegDB is public because the project is mainly educational and architectural. It is useful as a record of experiments in storage design, not as a claim that it should replace established embedded databases.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
