{"id":27197079,"url":"https://github.com/mk6i/mkdb","last_synced_at":"2025-06-17T05:36:17.634Z","repository":{"id":64849597,"uuid":"483856375","full_name":"mk6i/mkdb","owner":"mk6i","description":"mkdb is a SQL-based relational database management system (RDBMS) written in Golang (1.18+) with zero third-party dependencies. The goal of the project is to provide a creative outlet for developers who want to experiment with database development in a low-stakes environment.","archived":false,"fork":false,"pushed_at":"2024-05-29T16:36:08.000Z","size":218,"stargazers_count":35,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T20:35:43.615Z","etag":null,"topics":["bplus-tree","database","database-development","go","golang","rdbms","recursive-descent-parser","sql","sql-parser","write-ahead-log"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mk6i.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-21T00:36:50.000Z","updated_at":"2025-03-28T23:03:48.000Z","dependencies_parsed_at":"2024-01-05T02:36:26.936Z","dependency_job_id":"49c74e74-4413-4eba-8a2b-6c01db5dcdf9","html_url":"https://github.com/mk6i/mkdb","commit_stats":null,"previous_names":["mk6i/mkdb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mk6i/mkdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk6i%2Fmkdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk6i%2Fmkdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk6i%2Fmkdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk6i%2Fmkdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mk6i","download_url":"https://codeload.github.com/mk6i/mkdb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk6i%2Fmkdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260299974,"owners_count":22988672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bplus-tree","database","database-development","go","golang","rdbms","recursive-descent-parser","sql","sql-parser","write-ahead-log"],"created_at":"2025-04-09T20:27:08.265Z","updated_at":"2025-06-17T05:36:17.599Z","avatar_url":"https://github.com/mk6i.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\u003cimg width=\"742\" alt=\"mkdb console\" src=\"https://user-images.githubusercontent.com/2894330/232939901-d92bf2e4-b4d0-4aa4-80a9-70ecf8a9753e.png\"\u003e\u003c/p\u003e\n\n**mkdb** is a SQL-based relational database management system (RDBMS) written in Golang (1.18+) with zero third-party\ndependencies. The goal of the project is to provide a creative outlet for developers who want to experiment with\ndatabase development in a low-stakes environment.\n\nThe goal of this project is largely inspired by [SerenityOS](https://serenityos.org/).\n\n## 🛠️ Features\n\n- [Recursive-descent](https://en.wikipedia.org/wiki/Recursive_descent_parser) SQL parser that loosely follows\n  the [SQL-92 grammar](https://ronsavage.github.io/SQL/sql-92.bnf.html).\n- Typical SQL operations:\n    - DQL \u0026 DML: `SELECT`, `DELETE`, `INSERT`, `UPDATE`\n    - DDL: `CREATE DATABASE`, `CREATE TABLE`, `SHOW DATABASE`\n    - Joining: `LEFT JOIN`, `RIGHT JOIN`, `INNER JOIN`\n    - Aggregation: `GROUP BY`, `COUNT(...)`, `AVG(...)`\n    - Ordering \u0026 Limiting: `ORDER BY`, `LIMIT`\n    - Conditional clauses and boolean expressions: `WHERE`, `AND`, `OR`\n- On-disk [B+ tree](https://en.wikipedia.org/wiki/B%2B_tree).\n  -  Table rows are limited to 409 bytes in size.\n- Basic data durability properties:\n    - Write-ahead logging [(WAL)](https://en.wikipedia.org/wiki/Write-ahead_logging).\n    - Page cache\n      with [`NO FORCE`](http://www.cs.rpi.edu/~sibel/csci4380/spring2016/course_notes/transactions_durability.html#no-force), [`NO STEAL`](http://www.cs.rpi.edu/~sibel/csci4380/spring2016/course_notes/transactions_durability.html#no-steal)\n      semantics.\n        - By design, the database terminates on `INSERT` when the page cache is completely full of dirty pages. 🙃\n\n## 🔎 Quick Start\n\n**1. Clone the repo**\n\n```shell\ngit clone https://github.com/mk6i/mkdb.git \u0026\u0026 cd mkdb/\n```\n\n**2. Start a console session**\n\n\u003e To run mkdb, you'll need to install [golang](https://go.dev/doc/install).\n\n```shell\ngo run ./cmd/console\n```\n\n**3. Set up the database and tables**\n\nRun the following queries inside the SQL terminal to set up a database, table, and some data.\n\n```sql\nCREATE\nDATABASE testdb;\n\nUSE\ntestdb;\n\nCREATE TABLE weather\n(\n    hour         int,\n    city         varchar(255),\n    temp         int,\n    rel_humidity int\n);\n\nINSERT INTO weather (hour, city, temp, rel_humidity)\nVALUES (10, 'New York City', 71, 45),\n       (12, 'New York City', 84, 50),\n       (12, 'San Francisco', 72, 45),\n       (12, 'Austin', 90, 40),\n       (14, 'New York City', 87, 65),\n       (14, 'San Francisco', 75, 60),\n       (14, 'Austin', 95, 42),\n       (18, 'New York City', 64, 70),\n       (18, 'San Francisco', 55, 50),\n       (18, 'Austin', 85, 45),\n       (20, 'Austin', 79, 40);\n```\n\nRun this query to calculate the average temperature and relative humidity per city:\n\n```sql\nSELECT city, avg(temp) as avg_temp, avg(rel_humidity)\nFROM weather\nGROUP BY city;\n```\n\n**4. Cleanup**\n\nReady for a clean slate? The following command clears out the database and its associated files.\n\n```shell\nmake clean\n```\n\n## 🧭 Roadmap\n\nNew SQL features will be added on an ad-hoc basis. \n\nThe following engine features will be worked on in 2023:\n\n- B+ Tree indexes\n- Non-concurrent transactions\n- Client-server mode\n- [`[STEAL]`](http://www.cs.rpi.edu/~sibel/csci4380/spring2016/course_notes/transactions_durability.html#steal) semantics\n\n## 🙌 Contributing\n\nPull requests welcome!\n\nThe following resources can help get you up to speed on concepts relevant to developing a database:\n\n- [*Database Internals*](https://www.amazon.com/Database-Internals-Deep-Distributed-Systems/dp/1492040347), Alex Petrov, 2019\n  -  An excellent resource for learning about how datastore storage engines work at high-level. The B+ Tree is based on the descriptions in the book.\n- [*Crafting Interpreters*](https://craftinginterpreters.com/), Robert Nystrom, 2021\n  - The recursive-descent SQL parser is based on the techniques described in this free book.\n- *Inside SQLite*, Sibsankar Haldar, 2007\n  - Accessible literature on the inner workers in SQLite. Currently out of print, but can be found on the high seas.\n\nWhile developing, please respect to these two rules:\n\n- Do not introduce any 3rd-party dependencies. ([`golang.org/x`](https://pkg.go.dev/golang.org/x) packages are welcome, however.) Re-inventing the wheel is encouraged in the name of learning.\n- Do not base features/fixes on existing open-source database code. Learn what you can by reading the abundant technical database literature available online.\n\n## 📄  License\n\nmkdb is licensed under the MIT license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmk6i%2Fmkdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmk6i%2Fmkdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmk6i%2Fmkdb/lists"}