PythonAsia 2026

PythonAsia 2026

Inside a Database: A Code-Level Walkthrough of an RDBMS I Built in Python
2026-03-21 , Pardo Hall (Secondary Hall)

This talk explores the inner workings of an RDBMS through KeiPyDB, a custom RDBMS I implemented in Python.We will follow the processing flow of a SELECT statement step by step, covering lexical analysis, parsing, abstract syntax tree construction, query planning, and execution, using code examples and debugger output.
The talk also covers the storage layer. By inspecting actual data files with a hex viewer, we will observe how pages and records are stored on disk, and how INSERT and DELETE operations modify them.

The goal of this session is to provide a clear, concrete understanding of the main components that make up an RDBMS. It is intended for attendees who are familiar with SQL but have not yet examined how a database processes queries internally.


As generative AI becomes increasingly prevalent in code generation, understanding "why this code works" becomes more important than ever. Relational databases are used every day, yet many developers may not be familiar with how a query is processed internally. This talk explains the key internal components of an RDBMS by examining KeiPyDB, a custom implementation written in Python.
Structure
- Introduction (3 min) : Speaker introduction, motivation for building KeiPyDB, and high-level architecture overview
- SQL Parser and Execution Engine (15 min) : Using a SELECT statement as an example, we will trace how SQL is tokenized by the lexer, parsed into an AST, transformed by the query planner, and executed by the executor, with Python code and debugger output.
- Disk I/O and Storage Format (8 min) We will inspect actual data files with a hex viewer to observe how INSERT and DELETE operations modify physical storage.
- Endianness (2 min) Brief explanation of endianness and its role in binary record formats.

An RDBMS consists of multiple subsystems—lexer, parser, planner, executor, and storage layer—each with a clearly defined responsibility. By following the flow of a query step by step, this session will provide attendees with a practical understanding of how relational databases process and store data internally.


Category: Case Study/Industry Application Audience Level: Beginner

I work as a software engineer, mainly on test automation, CI/CD tooling, and authorization systems for production services.