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:

  • List of SELECT fields together with their column names and their expressions (an expression is a data structure that describes how to compute a value)
  • List of FROM tables with their table aliases as well as their table names (or subqueries)
  • WHERE, GROUP, HAVING, ORDER BY, LIMIT clauses and so on

Then, there is a plan to flatten down any subqueries into a single FROM clause (according to this paper:

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.

Durch die weitere Nutzung der Seite stimmst du der Verwendung von Cookies zu. Weitere Informationen

Die Cookie-Einstellungen auf dieser Website sind auf "Cookies zulassen" eingestellt, um das beste Surferlebnis zu ermöglichen. Wenn du diese Website ohne Änderung der Cookie-Einstellungen verwendest oder auf "Akzeptieren" klickst, erklärst du sich damit einverstanden.