Previous Page TOC Index Next Page

SQL PARSER AND OPTIMIZER


The SOLID SQL Parser and Optimizer are designed to efficiently execute SQL statements within the latest standards.

Undisplayed Graphic

SOLID provides an efficient parser and cost-based optimizer. The statistical information about actual data is maintained automatically. This ensures optimal performance even when the data is changed dynamically.

Dynamic Optimizer Technology

The task of the SQL parser in a database server is to parse the SQL statements submitted from client applications and to determine a way to retrieve or store data according to these statements.

The task of the SQL optimizer is to make sure that the execution of SQL statements is done efficiently. There are two kinds of SQL optimizers:

Rule-based Optimizers

A rule-based optimizer determines the most effective way to execute an SQL statement by applying a set of preprogrammed rules. These rules can be, for example: whether or not an index exists, is the index a unique index, and is the index over single or composite table columns. This method offers very limited possibilities for evaluating the most efficient path for the query.

Cost-based Optimizers

SOLID Server offers a cost-based optimizer that uses the same basic techniques as a rule-based optimizer to determine the shortest path to the results. Additionally, it can adapt to the actual content of the database, e.g., the number of rows and the value distribution of individual columns. The extra information leads to better decisions in the optimization process. SOLID Server maintains the statistical information automatically. This is important because the amount and content of data changes, and thus the most effective route to the data may change.

The modern cost-based optimizer of SOLID Server offers the following advanced features:

The processing of an SQL statement requires an adequate amount of central memory. When a statement is parsed, information necessary for its execution is loaded into the statement cache. A statement can be executed repeatedly without re-optimization, as long as its execution information remains in the statement cache.

Query Processing

Query processing in the SOLID SQL Parser and Optimizer proceeds in a sequence containing the following phases:

All query processing phases are performed in small steps to ensure that one client ‘s time-consuming operation does not block other clients’ requests even in single-threaded environments.

Syntax Analysis

The syntax analysis takes the SQL query as input and produces either a parse tree for the query or a syntax error.

Creating the Execution Graph

The execution graph is created from the query parse tree. It can have the following components:

The execution graph of an SQL query can be obtained from SOLID Server for analysis with the EXPLAIN PLAN statement.

Processing the Execution Graph

Processing of the execution graph is performed in three consecutive phases:

Type-evaluation Phase

The data types of the columns of the result set are derived from the underlying table and view definitions.

Estimate-evaluation Phase

The cost of retrieving first rows and also entire result sets is evaluated, and an appropriate search strategy is selected dynamically based on the bound parameter values.

Row-retrieval Phase

The result rows of the query are retrieved and returned to the client application.

Previous Page TOC Index Next Page

Copyright © 1992-1997 Solid Information Technology Ltd All rights reserved.