MemCP: First SQL Query is correctly executed

MemCP: First SQL Query is correctly executed

MemCP now executed its first SQL Query:

MySQL [(none)]> select 1+2 AS x;
+------+
| x    |
+------+
| 3    |
+------+
1 row in set (0,000 sec)

As you can see, MemCP uses the MySQL protocol to communicate with its clients. There is also a REST endpoint but the REST endpoint is more suited for custom REST APIs (microservices and such) that want to run inside the same memory space as the database.

SQL compilation in MemCP works in two stages: Parse and Build Queryplan.

During the parse phase, a string called "SQL Query" is transformed into multiple lists:

Then, there is a plan to flatten down any subqueries into a single FROM clause (according to this paper: https://cs.emis.de/LNI/Proceedings/Proceedings241/383.pdf)

After that, the function build_queryplan decides:

After that is done, the query can be executed.

Result lines are provided as records that are passed through the MySQL protocol or in case of the REST API printed as a stream of JSON lines.

Categories