2017-09-01 18:32:27 -07:00
---
title: How Does a Database Work?
---
2017-08-31 15:47:36 -07:00
- What format is data saved in? (in memory and on disk)
- When does it move from memory to disk?
- Why can there only be one primary key per table?
- How does rolling back a transaction work?
- How are indexes formatted?
- When and how does a full table scan happen?
2017-08-31 18:41:20 -07:00
- What format is a prepared statement saved in?
2017-08-31 11:33:17 -07:00
2017-08-31 15:47:36 -07:00
In short, how does a database **work ** ?
2017-08-31 11:33:17 -07:00
2017-08-31 15:47:36 -07:00
I'm building a clone of [sqlite ](https://www.sqlite.org/arch.html ) from scratch in C in order to understand, and I'm going to document my process as I go.
2017-08-31 11:33:17 -07:00
# Table of Contents
2017-09-01 18:39:22 -07:00
{% for part in site.parts %}- [{{part.title}} ]({{site.baseurl}}{{part.url}} )
2017-09-01 18:32:27 -07:00
{% endfor %}
2017-08-31 15:47:36 -07:00
2017-09-17 21:00:15 -07:00
> "What I cannot create, I do not understand." -- [Richard Feynman](https://en.m.wikiquote.org/wiki/Richard_Feynman)
2017-08-31 15:57:56 -07:00
{% include image.html url="assets/images/arch2.gif" description="sqlite architecture (https://www.sqlite.org/arch.html)" %}