Query Decomposition
Query decomposition is the first phase of query processing. The aims of query decomposition
are to transform a high-level query into a relational algebra query, and to check that
the query is syntactically and semantically correct. The typical stages of query decomposition
are analysis, normalization, semantic analysis, simplification, and query restructuring.
(1) Analysis
In this stage, the query is lexically and syntactically analyzed using the techniques of
programming language compilers (see, for example, Aho and Ullman, 1977). In addition,
this stage verifies that the relations and attributes specified in the query are defined in the
system catalog. It also verifies that any operations applied to database objects are appropriate
for the object type. For example, consider the following query:
SELECT staffNumber
FROM Staff
WHERE position > 10;
This query would be rejected on two grounds:
(1) In the select list, the attribute staffNumber is not defined for the Staff relation (should be
staffNo).
(2) In the WHERE clause, the comparison ‘>10’ is incompatible with the data type
position, which is a variable character string.
On completion of this stage, the high-level query has been transformed into some internal
representation that is more suitable for processing. The internal form that is typically
chosen is some kind of query tree, which is constructed as follows:
n A leaf node is created for each base relation in the query.
n A non-leaf node is created for each intermediate relation produced by a relational
algebra operation.
n The root of the tree represents the result of the query.
n The sequence of operations is directed from the leaves to the root.
Query Decomposition
Query decomposition is the first phase of query processing. The aims of query decomposition
are to transform a high-level query into a relational algebra query, and to check that
the query is syntactically and semantically correct. The typical stages of query decomposition
are analysis, normalization, semantic analysis, simplification, and query restructuring.
(1) Analysis
In this stage, the query is lexically and syntactically analyzed using the techniques of
programming language compilers (see, for example, Aho and Ullman, 1977). In addition,
this stage verifies that the relations and attributes specified in the query are defined in the
system catalog. It also verifies that any operations applied to database objects are appropriate
for the object type. For example, consider the following query:
SELECT staffNumber
FROM Staff
WHERE position > 10;
This query would be rejected on two grounds:
(1) In the select list, the attribute staffNumber is not defined for the Staff relation (should be
staffNo).
(2) In the WHERE clause, the comparison ‘>10’ is incompatible with the data type
position, which is a variable character string.
On completion of this stage, the high-level query has been transformed into some internal
representation that is more suitable for processing. The internal form that is typically
chosen is some kind of query tree, which is constructed as follows:
n A leaf node is created for each base relation in the query.
n A non-leaf node is created for each intermediate relation produced by a relational
algebra operation.
n The root of the tree represents the result of the query.
n The sequence of operations is directed from the leaves to the root.
การแปล กรุณารอสักครู่..