Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/talent-plan/tinysql
A course to build the SQL layer of a distributed database.
https://github.com/talent-plan/tinysql
Last synced: 26 days ago
JSON representation
A course to build the SQL layer of a distributed database.
- Host: GitHub
- URL: https://github.com/talent-plan/tinysql
- Owner: talent-plan
- License: apache-2.0
- Created: 2020-01-02T13:09:30.000Z (almost 5 years ago)
- Default Branch: course
- Last Pushed: 2023-09-27T04:14:10.000Z (about 1 year ago)
- Last Synced: 2024-06-20T10:12:07.473Z (5 months ago)
- Language: Go
- Homepage:
- Size: 3.56 MB
- Stars: 1,645
- Watchers: 26
- Forks: 509
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- stars - talent-plan/tinysql
- my-awesome - talent-plan/tinysql - 09 star:1.7k fork:0.5k A course to build the SQL layer of a distributed database. (Go)
README
# TinySQL
TinySQL is a course designed to teach you how to implement a distributed relational database in Go. The name TinySQL indicates it is a simplifed version of [TiDB](https://github.com/pingcap/tidb).
## Prerequisites
Experience with Go is required. If not, it is recommended to learn [A Tour of Go](https://tour.golang.org/) first.
## Course Architecture
The entire course is designed based on [TiDB](https://github.com/pingcap/tidb).
The course is organized into six parts:
- Simple explanation of SQL and relational algebra [English](./courses/Proj1-README-en.md) | [Chinese](./courses/proj1-README-zh_CN.md)
- Parser [English](./courses/proj2-README-en.md) | [Chinese](./courses/proj2-README-zh_CN.md)
- DDL [English](./courses/proj3-README-en.md) | [Chinese](./courses/proj3-README-zh_CN.md)
- Optimizer [English](./courses/proj4-README-en.md) | [Chinese](./courses/proj4-README-zh_CN.md)
- Executor [English](./courses/proj5-README-en.md) | [Chinese](./courses/proj5-README-zh_CN.md)
- Percolator [English](./courses/proj6-README-en.md) | [Chinese](./courses/proj6-README-zh_CN.md)## Reference List
This [reference list](./courses/material.md) provides plenty of materials for you to study how a database system works. We pick some topics in it and prepare homework for you to have a better understand about it.
This course will take you from idea to implementation, with the essential topics of distributed relational database covered.
The course is organized into three parts:
1. Gives a simple interpretation of SQL and relational algebra in preparation for the following course.
2. Explains the life of a read-only SQL, which includes parsing, execution, and the optimization of SQL plans.
3. Focuses on SQLs (including DML and DDL) that change the state of the database: how they get implemented and how to deal with the interaction of them and read-only statements.
## Other courses in this series
This course only focuses on the SQL layer of a distributed database system. If you are also interested in KV layer, see [TinyKV](https://github.com/pingcap-incubator/tinykv).
## Deploy
Once you finish the project. You can deploy the binary and use MySQL client to connect the server.
### Build
```
make
```### Run & Play
Use `./bin/tidb-server` to deploy the server and use `mysql -h127.0.0.1 -P4000 -uroot` to connect the server.
Also you can deploy the cluster together with the tinykv project.
Use `make` command in tinykv project to build binary `tinyscheduler-server`, `tinykv-server`.
Then put the binaries into a single dir and run the following commands:
```
mkdir -p data
./tinyscheduler-server
./tinykv-server -path=data
./tidb-server --store=tikv --path="127.0.0.1:2379"
```## Autograding and certification
Since Jun 2022, we start using [github classroom](./classroom.md) to accept labs and provide autograding timely. The github classroom invitation is https://classroom.github.com/a/MZUEVGmB. The discussion Wechat/Slack group and the certification after you pass the class is provided in the [tinySQL learning class](https://talentplan.edu.pingcap.com/catalog/info/id:234)
Autograding is a workflow which can automatically run test cases and give feedback timely. However there are some limitations in Github classroom, in order to make golang work and run it in our self-hosted machines, **you need to overwrite the workflow generated by Github classroom and commit it**.
```sh
cp scripts/classroom.yml .github/workflows/classroom.yml
git add .github
git commit -m"update github classroom workflow"
```## Contributing
Contributions are welcomed and greatly appreciated. See [Contribution Guide](https://github.com/pingcap/community/tree/master/contributors) for details on submitting patches and the contribution workflow.
## License
TinySQL is under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for details.