1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
<HTML>
<HEAD>
<TITLE></TITLE>
<LINK REL="ToC" HREF="httoc.htm">
<LINK REL="Index" HREF="htindex.htm">
<LINK REL="Next" HREF="td000008.htm">
<LINK REL="Previous" HREF="td000006.htm"></HEAD>
<BODY BGCOLOR="#FFFFFF">
<P ALIGN=CENTER>
<A HREF="td000006.htm" TARGET="_self"><IMG SRC="gtd/graprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="httoc.htm" TARGET="_self"><IMG SRC="gtd/gratoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="htindex.htm" TARGET="_self"><IMG SRC="gtd/graindex.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Index"></A>
<A HREF="td000008.htm" TARGET="_self"><IMG SRC="gtd/granext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
<A NAME="E9E5"></A>
<H1>
<FONT FACE="Arial"><B>SQL PARSER AND </B><B>OPTIMIZER</B></FONT></H1>
<BR>
<BLOCKQUOTE>
<P>The SOLID SQL Parser and Optimizer are designed to efficiently execute SQL statements within the latest standards.
</BLOCKQUOTE>
<P>
<IMG SRC="gtd/td000018.gif" WIDTH = 130 HEIGHT = 186 ALT="Undisplayed Graphic">
<BLOCKQUOTE>
<P><I>SOLID provides an efficient parser and cost-based optimizer. The statistical information about </I><I>actual data is maintained automatically. This ensures optimal performance even when the data </I><I>is changed dynamically.</I>
</BLOCKQUOTE>
<A NAME="E10E15"></A>
<H2>
<FONT FACE="Arial"><B>Dynamic Optimizer Technology</B></FONT></H2>
<BLOCKQUOTE>
<P>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.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>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<A NAME="I2"></A>:
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>
<FONT FACE="Arial"><B>Rule-based Optimizers</B></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>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.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>
<FONT FACE="Arial"><B>Cost-based Optimizers</B></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>SOLID <I>Server</I> 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 <I>Server</I> 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.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The modern cost-based optimizer of SOLID <I>Server</I> offers the following advanced features:<A NAME="I3"></A><A NAME="I4"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>Query flattening rewrites complex statements to a uniform and more simple form leading to high and consistent performance.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>ORs-to-UNIONSs optimization converts OR criteria to UNION clauses when better performance can be achieved.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>Intelligent join constraint transfer offers dynamic and more limiting restrictions thus materializing in smaller intermediate join results and reducing the join process execution time.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>Optimizations can be tuned for best response time (fast first) or best overall query time.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>Dynamic in-memory sorting for an arbitrary amount of data optimally utilizes the main memory resources.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>All cost estimates are based on automatically maintained information on key value distribution, table sizes, and other dynamic statistical data. There is no need to manually update the index histograms or any other estimation information.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>The message-based internal architecture offers an efficient transition path to parallel query execution.
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P>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.
</BLOCKQUOTE>
<A NAME="E10E16"></A>
<H2>
<FONT FACE="Arial"><B>Query Processing</B></FONT></H2>
<BLOCKQUOTE>
<P>Query processing in the SOLID SQL Parser and Optimizer proceeds in a sequence containing the following phases:<A NAME="I5"></A><A NAME="I6"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>syntax analysis
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>creating the execution graph
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>processing the execution graph
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P>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.
</BLOCKQUOTE>
<H3>
<FONT FACE="Arial"><A NAME="I7"></A><A NAME="I8"></A><A NAME="I9"></A><A NAME="I10"></A><A NAME="I11"></A><A NAME="I12"></A><A NAME="I13"></A><A NAME="I14"></A><A NAME="I15"></A><A NAME="I16"></A><A NAME="I17"></A><A NAME="I18"></A><A NAME="I19"></A><A NAME="I20"></A><A NAME="I21"></A><A NAME="I22"></A><A NAME="I23"></A><A NAME="I24"></A><A NAME="I25"></A><A NAME="I26"></A><A NAME="I27"></A><A NAME="I28"></A><A NAME="I29"></A><A NAME="I30"></A><A NAME="I31"></A><B>Syntax Analysis</B></FONT></H3>
<BLOCKQUOTE>
<P>The syntax analysis takes the SQL query as input and produces either a parse tree for the query or a syntax error.<A NAME="I32"></A><A NAME="I33"></A><A NAME="I34"></A><A NAME="I35"></A><A NAME="I36"></A><A NAME="I37"></A><A NAME="I38"></A><A NAME="I39"></A><A NAME="I40"></A><A NAME="I41"></A><A NAME="I42"></A><A NAME="I43"></A><A NAME="I44"></A><A NAME="I45"></A><A NAME="I46"></A><A NAME="I47"></A><A NAME="I48"></A><A NAME="I49"></A><A NAME="I50"></A><A NAME="I51"></A><A NAME="I52"></A><A NAME="I53"></A><A NAME="I54"></A><A NAME="I55"></A><A NAME="I56"></A>
</BLOCKQUOTE>
<H3>
<FONT FACE="Arial"><B>Creating the Execution Graph</B></FONT></H3>
<BLOCKQUOTE>
<P>The execution graph is created from the query parse tree. It can have the following components:
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>TABLE units to call the table-level search functions of the Database Engine.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>JOIN units to perform N-way joins with specified constraints.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>GROUP units to perform grouping and aggregate function calling (SUM, MIN etc.)
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>DIST units to perform the "DISTINCT" operation.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>UNION units to perform the union operation.
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>ORDER units to sort the rows with specified criteria.
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P>The execution graph of an SQL query can be obtained from SOLID Server for analysis with the EXPLAIN PLAN statement.
</BLOCKQUOTE>
<H3>
<FONT FACE="Arial"><A NAME="I57"></A><A NAME="I58"></A><A NAME="I59"></A><A NAME="I60"></A><A NAME="I61"></A><A NAME="I62"></A><A NAME="I63"></A><A NAME="I64"></A><A NAME="I65"></A><A NAME="I66"></A><A NAME="I67"></A><A NAME="I68"></A><A NAME="I69"></A><A NAME="I70"></A><A NAME="I71"></A><A NAME="I72"></A><A NAME="I73"></A><A NAME="I74"></A><A NAME="I75"></A><A NAME="I76"></A><A NAME="I77"></A><A NAME="I78"></A><A NAME="I79"></A><A NAME="I80"></A><A NAME="I81"></A><B>Processing the Execution Graph</B></FONT></H3>
<BLOCKQUOTE>
<P>Processing of the execution graph is performed in three consecutive phases:
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>
<FONT FACE="Arial"><B>Type-evaluation Phase</B></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The data types of the columns of the result set are derived from the underlying table and view definitions.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>
<FONT FACE="Arial"><B>Estimate-evaluation Phase</B></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>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.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>
<FONT FACE="Arial"><B>Row-retrieval Phase</B></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The result rows of the query are retrieved and returned to the client application.
</BLOCKQUOTE>
<A NAME="E7E7"></A>
<P ALIGN=CENTER>
<A HREF="td000006.htm" TARGET="_self"><IMG SRC="gtd/graprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="httoc.htm" TARGET="_self"><IMG SRC="gtd/gratoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="htindex.htm" TARGET="_self"><IMG SRC="gtd/graindex.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Index"></A>
<A HREF="td000008.htm" TARGET="_self"><IMG SRC="gtd/granext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
<center><p><font SIZE=-2>Copyright © 1992-1997 Solid Information Technology Ltd All rights reserved.</font></p></center>
</BODY></HTML>
|