This is a project to develop SimpleDB in Rust.
text: Database Design and Implementation: Second Edition
[youtube]: https://www.youtube.com/watch?v=vr0wQq7cvHQDone to implement all of book contents, but any exercise.
You need to install capnproto for building this project.
sudo apt install capnproto
cargo build
How to connect and run sql for a database named dbname on embedded version is like below.
cargo run --bin esql -- -d <dbname>
How to run simpledb-server.
cargo run --bin simpledb-server
How to run sql as simpledb client program.
cargo run --bin sql -- -d <dbname>
take benchmarking data.
./benchmarks.sh
and then run http-server. You must install http-server on npm, if you view the results on your local.
cd benchmarks
http-server -p 3000
and then open browser http://localhost:3000?scale=tiny. At this url, query parameter scale can has tiny/small/medium/large.
use rlwrap in order to edit query prettier.
$ rlwrap cargo run --bin esql -- -d <dbname>
check table catalogs.
SQL> :t tblcat
* table: tblcat has 2 fields.
# name type
--------------------------------------
1 tblname varchar(16)
2 slotsize integer
SQL> SELECT tblname FROM tblcat;
tblname
------------------
tblcat
fldcat
viewcat
idxcat
student
dept
course
section
enroll
sex
transaction 6 committed
Rows 10 (0.000s)
SQL>
check field catalogs.
SQL> :t fldcat
* table: fldcat has 5 fields.
# name type
--------------------------------------
1 tblname varchar(16)
2 fldname varchar(16)
3 type integer
4 length integer
5 offset integer
SQL> SELECT tblname, fldname, type, length FROM fldcat;
tblname fldname type length
----------------------------------------------------
...
student sid 2 0
student sname 3 10
student grad_year 1 0
student major_id 2 0
student birth 5 0
student sex 4 0
transaction 9 committed
Rows 33 (0.001s)
check view catalog
SQL> SELECT viewname, viewdef FROM viewcat;
viewname viewdef
------------------------------------------------------------------------------------------------------------------------
einstein select sect_id from section where prof='einstein'
transaction 3 committed
Rows 1 (0.000s)
SQL>