The parser can be found in the parser folder. It is written using flex and bison. A given query is parsed, the tokens are transformed into statements which will be consumed by the planner.
The parser can be found in the plan/logical folder. After parsing the query, the planner will create a canonical query plan and perform some required steps to preprocess the plan for the execution engine.
The optimizer can be found in the plan/optimizer folder.
It implements a rule-based optimization based on a flexible and extensible framework, for example, evaluating constant arithmetics (a.foo > 4+2
, cast 42 as decimal(4,2)
), predicate pushdown, join re-ordering, and early projection.
The execution engine can be found in the execution folder which is divided into interpretation and compilation engines. Both engines use MxTasking as an execution framework instead of classic threads transforming the logical plan into a task-graph. The task-graph can be found in the plan/physical folder.
The catalog can be found in the topology folder providing table and schema (logical and physical) implementation. Tuples are accessed using views and (constant) value implementations which can be found in data. Types are implemented in the type folder. At the moment, TunaDB supports the following types:
CHAR
(of fixed lengths)INT
(32 bit)BIGINT
(64 bit)DOUBLE
(with precision and scale)DATE
TunaDB has several options for explaining and profiling query execution, such as displaying query plans, generated query code, and performance counters during execution.
explain select * from <table> where <expression>
explain task graph select * from <table> where <expression>
explain performance select * from <table> where <expression>
explain flounder select * from <table> where <expression>
explain asm select * from <table> where <expression>
create table foo (id int, name char(30));
insert into foo [(id, name)] values (1, 'Heinz') [,(2, 'Dieter')];
copy foo from 'path/to/file.csv [(delimiter '|')];
(default delimiter is;
)
Command | Description |
---|---|
.tables |
List all tables |
.table foo |
Show schema of table foo |
.update statistics foo |
Update statistics of table foo |
.load file 'path/to/file.sql' |
Execute all commands of the file path/to/file.sql |
- The application
bin/tunadb
will start an in-memory database system and connect a command line client. - To intially load some data, use the
--load
argument:./bin/tunadb --load sql/load_sf01.sql
. - For a full list of possible arguments see
./bin/tunadb -h
. - Most notably arguments:
--execute "<query>"
will execute the given query immediatly, could also be a file, i.e.,--execute sql/queries/tpch/q06.sql
, and can includeexplain
keywords (e.g.,explain performance select ...
).--server-only
will start the server only.--client-only
will start the (command line) client only.
When using --web-client
flag on startup, tunadb will start a web console at http://0.0.0.0:9100.