Databases Reference
In-Depth Information
Once the parse tree has been constructed, the Algebrizer performs the binding
operation, which is mostly concerned with name resolution. During this operation,
the Algebrizer makes sure that all of the objects named in the query do actually exist,
confirms that the requested operations between them are valid, and verifies that the
objects are visible to the user running the query. It also associates every table and column
name on the parse tree with their corresponding object in the system catalog. Name
resolution for views includes the process of view substitution, where a view reference is
expanded to include the view definition; for example, to directly include the tables used
in the view. The output of the binding operation, which is called an algebrized tree, is
then sent to the Query Optimizer for (as you'll have guessed) optimization.
Originally, this tree will be represented as a series of logical operations which are closely
related to the original syntax of the query. These will include such logical operations as
"get data from the Customer table," "get data from the Contact table," "perform an inner
join," and so on. Different tree representations of the query will be used throughout the
optimization process, and this logical tree will receive different names, until it is finally
used to initialize the memo structure, as we'll discuss later.
For example, the following query will have a tree representation as shown in Figure 5-1.
SELECT c . CustomerID , COUNT (*)
FROM Sales . Customer c JOIN Sales . SalesOrderHeader o
ON c . CustomerID = o . CustomerID
WHERE c . TerritoryID = 4
GROUP BY c . CustomerID
Listing 5-8.
Search WWH ::




Custom Search