Skip to content
This repository has been archived by the owner on Jan 3, 2022. It is now read-only.

SQL Execution Plan

Antonello Provenzano edited this page Dec 17, 2015 · 1 revision

The SQL Model

DeveelDB implements the standard ANSI/ISO SQL-99 and defines a set of database objects, statements and expressions that are used to manage the system and interact with the data stored.

Database Objects

Object Managers

There are several kind of database objects in a DeveelDB system, and some are dependent from others (for instance, a user type depends on tables). A special contract determines how the system should find and manage them: these are the IObjectManager implementations: object managers are services registered at the moment of building a database system and are intended as providers for the objects (to find existing) or creators/destroyers. The default system builder provides a default set of object managers for all the foundation object types (see the list below): a user can redefine an object manager before the system is built, but special attention must be taken.

Foundation Objects

  • Tables
  • Views
  • Types
  • Variables (Transient and Persistent)
  • Rows
  • Columns
  • Triggers (Callback and Procedural)
  • Sequences (Native and User-Defined)
  • Routines (Functions and Procedures)
  • Cursors
  • Schemata

SQL Statements

To interact with the objects of a database, a user must invoke some defined SQL statements, that can be constructed programmatically or as a result of the parsing of a SQL text command. A statement is a single command within a request context, that can be executed at the top level of a query or even inside a programmed block of code (eg. the PL/SQL block of a routine or a trigger).

DeveelDB provides the contract IStatement to identify SQL statements, that can be extended by the IPreparableStatement contract, to indicate a statement requires a special preparation before being executed (for example, to qualify the name of a table to access, to execute the call to a function, etc.). Since statements can be the containers for expressions (and in most of the cases they are), they are often extended by the IPreparable interface, that allows the preparation of the expressions contained, before the execution.

Because of this schema, before the execution of a statement, the system prepares the statement with specialized calls, returning an object ready to be executed.

In case of stored programming blocks (eg. the body of a trigger or the body of a routine), the system prepares the statements that form the blocks and saves the prepared version of the statement, that will be executed in the subsequent calls.

PL/SQL Blocks

Code blocks are formed of multiple statements and they consist of a sequence of commands that are executed in a context. These blocks can be part of a whole larger context (eg. a trigger body) or being defined at execution time by the user (eg. a BEGIN ... END block).

Each block defines a new execution context, in which variables defined within it are stored, retrieved and disposed at its end.

Loops are special blocks, which are executed according to some specific conditions