A simple, educational Postgres-compatible database written in Elixir.
Build a minimal, understandable database server that speaks the Postgres wire protocol and implements core database features, step by step.
- Wire Protocol with Server: Accept client connections and speak the Postgres protocol.
- SQL Parser: Parse incoming SQL queries.
- In-Memory Storage & Buffer Pool: Store data in memory with a basic buffer pool.
- Query Executor: Execute parsed queries against the in-memory storage.
- Persistence (Disk Storage): Add disk-based storage for durability.
- Transactions & WAL: Support transactions and implement Write-Ahead Logging.
- B-tree Indexes: Add indexing for efficient data retrieval.
- Advanced Features: Implement joins and other advanced SQL features.
This project is for learning and experimentation. Contributions and questions are welcome!
If available in Hex, the package can be installed
by adding ex_db
to your list of dependencies in mix.exs
:
def deps do
[
{:ex_db, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_db.
Startup Packet start with the length followed by the protocol version. |int32 len|int32 protocol|payload| |int32 len|int32 protocol|str name|\0|str value|\0| All other message start with an ASCII identifier, followed by length and payload |char tag|int32 len|payload|