<?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: kimhjo</title>
    <description>The latest articles on DEV Community by kimhjo (@hyeonjo00).</description>
    <link>https://dev.to/hyeonjo00</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3883826%2F0db217fb-7504-4156-a780-186e775b8164.jpg</url>
      <title>DEV Community: kimhjo</title>
      <link>https://dev.to/hyeonjo00</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hyeonjo00"/>
    <language>en</language>
    <item>
      <title>I built a database engine in pure C – here's what I learned</title>
      <dc:creator>kimhjo</dc:creator>
      <pubDate>Fri, 17 Apr 2026 06:58:00 +0000</pubDate>
      <link>https://dev.to/hyeonjo00/i-built-a-database-engine-in-pure-c-heres-what-i-learned-95o</link>
      <guid>https://dev.to/hyeonjo00/i-built-a-database-engine-in-pure-c-heres-what-i-learned-95o</guid>
      <description>&lt;p&gt;I recently built MiniDB Studio, a lightweight database engine in pure C (C11) &lt;br&gt;
as a learning project. Here's what I ended up building and what surprised me along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;B+ Tree indexing on id and age fields&lt;/li&gt;
&lt;li&gt;Hash indexes for fast exact lookups&lt;/li&gt;
&lt;li&gt;WAL-style crash recovery with CSV snapshot replay&lt;/li&gt;
&lt;li&gt;A native desktop UI built with raylib&lt;/li&gt;
&lt;li&gt;A lightweight query optimizer for range scans and ordered traversal&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The hardest part
&lt;/h2&gt;

&lt;p&gt;Getting WAL replay to behave correctly after a crash mid-write was the &lt;br&gt;
most painful part. The tricky case is when a write is partially flushed &lt;br&gt;
before the crash — you need to detect the incomplete entry and roll back &lt;br&gt;
to the last clean checkpoint without corrupting the rest of the log.&lt;/p&gt;

&lt;h2&gt;
  
  
  The architecture
&lt;/h2&gt;

&lt;p&gt;The project is split into two layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A reusable pure C storage engine library&lt;/li&gt;
&lt;li&gt;A separate UI binary that links against it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keeping them decoupled meant I could test the engine independently &lt;br&gt;
without the UI getting in the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd do differently
&lt;/h2&gt;

&lt;p&gt;If I built this again I'd add a proper buffer pool manager earlier. &lt;br&gt;
Right now reads go straight to disk more often than they should.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/hyeonjo00/c-mini-db-engine" rel="noopener noreferrer"&gt;https://github.com/hyeonjo00/c-mini-db-engine&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Whitepaper: &lt;a href="https://github.com/hyeonjo00/c-mini-db-engine/blob/main/docs/minidb-studio-algorithm-whitepaper-en.pdf" rel="noopener noreferrer"&gt;https://github.com/hyeonjo00/c-mini-db-engine/blob/main/docs/minidb-studio-algorithm-whitepaper-en.pdf&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feedback welcome — especially on the storage engine design.&lt;/p&gt;

</description>
      <category>c</category>
      <category>database</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
