Execution Engine

After the translation and optimization phases, we will have a query represented as a minimal abstract syntax tree, which we evaluate using a simple bottom-up interpreter-based system. No attempt is made to "compile" the query into an "executable" form, because we may want to do further optimizations on the query once it has been partially evaluated. This is one idea for reducing execution time that we are considering in the future.

The engine can evaluate portions of a query in parallel, for example when building the elements of a collection where the value of each element does not depend on the value of the others. Lazy (or "pipelined") query evaluation is also possible, though this is not fully implemented yet.

Queries are executed within an environment. There is an initial environment which contains all of the entry points exported by the data drivers, and all of the functions that were defined at the time the server was started. All client connections begin with this environment. During the course of a connection, each client can add new function definitions (or replace existing ones), or include object models against which they can execute queries. These additions to the environment affect only the client in question, not any other existing or future clients.

[K2 Front Page]