Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesSQL Compilers: The Performance Nexus


November 1995 / Reviews / Enterprise Database Managers / SQL Compilers: The Performance Nexus

The database engine's SQL compiler is arguably the most important part of an RDBMS. It must recognize and understand natural language (SQL), then turn the SQL statements into "instructions" it gives to the database engine's retrieval and update processes. The job is compounded by speed requirements.

SQL compilers process SQL statements in five basic steps. The first step parses the SQL, examines it for syntax errors, then converts the SQL parse tree into an internal representation. The second step examines the reformatted SQL to ensure that executing the statement won't violate referential integrity. This step also notes whether the database engine should process a constraint or trigger for the SQL.

Next, the SQL compiler rewrites the SQL statement, replacing view references with actual column names and transforming the SQL for processing by the optimizer. The transformation eliminates redundant joins, adds implied predicates, and converts INTERSECT clauses to EXISTS subqueries.

In the fourth step, the optimizer uses cost-based algorithms to determine the most efficient execution method for the SQL statement. It finds the best join order, for example, and it decides whether the execution of the SQL statement will be CPU- or I/O-bound. The optimizer chooses an execution path for the SQL statement that will result in the quickest response from the database engine.

The fifth step "remembers" the essence of the SQL statement for later comparison with other SQL statements; the SQL compiler keeps a history of how well it optimizes statements so it can "learn" the fastest ways to access the database. After this fifth step, the SQL compiler delivers the compil ed, optimized SQL statement to the retrieval and update processes in the database engine.


SQL Compiler

illustration_link (3 Kbytes)

An RDBMS's SQL compiler has a central role in making efficient queries.


Up to the Reviews section contentsGo to previous article: Enterprise Database ManagersGo to next article: Organization Made Loud and ClearSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network