A database implementation from scratch in Rust for study purpose.
The most implementations is based on Postgresql implementation itself. Some design choices are:
- Buffer pool manager written from scratch (Tinydb don't use mmap)
- LRU algorithm implementation for buffer victim
- Heap file format is used to store database files.
- NULL values are handled using a bitmap
- Postgres Wire Protocol implementation
Tinydb is develop in Rust, so it's necessary to have the Rust build toolchain installed.
Once you have installed the Rust toolchanin, just clone the repository, build the binary and run.
git clone https://github.com/msAlcantara/tinydb
cargo install --path .
Tinydb is a server database that implements the PostgreSQL Wire Protocol so any PostgreSQL client can be used with tinydb.
The database directory should be initialized when running tinydb for the first time: tinydb --init
For second run, you can just type tinydb
to start the server with default configurations.
And them you can connect using psql or any other Postgres client:
psql -h localhost -p 6379 -d tinydb
The supported data types are
- INT
- VARCHAR
- BOOL
CREATE TABLE t(a int, b varchar, c boolean);
INSERT INTO t(a, b, c) VALUES(42, 'tinydb', true);
SELECT * FROM t;