Reference no: EM13808438
1. Describe typical steps followed when processing a high-level query.
The function of query parser is parser is parsing and translating a given high-level language query into its immediate form such ass relational algebra expressions. The function of the parser is to check both syntax and semantic of the queries. A parser tree of the query specifies only partially how to evaluate a query, there are several ways to evaluate a relational algebra expression. Therefore the steps that are followed in query processing are as follows:
i. Scanning and parsing.
ii. Query optimization or planning the execution strategy
iii. Query code generator(interpreter or compiled)
iv. Execution in the runtime database processor.
2. Compare the roles of a scanner and a parser with reference to query processing.
Scanning is the process of converting the query text into a tokenized representation. The tokenized representation is more compact and it is suitable for processing by the parser. The representation can be done in a tree form. The parser checks the tokenized representation for correct syntax. In this stage it checks to determine if columns and tables identified in the query exist in the database and if the query has been formed correctly with the appropriate keywords and structure. If the query passes the parsing checks, then it is passed on to the query optimizer.
3. What a query execution plan?
4. Discuss the reasons for converting SQL queries into relational algebra queries before optimization is done.
5. Explain the three factors that influence the cost of a query.
6. A file of 4096 blocks is to be sorted with an available buffer space of 64 blocks. How many passes will be needed in the merge phase of the external sort-merge algorithm?
7. In a particular transaction, the number of file blocks of data to be fetched is 6 while the size of entire file is 2048 blocks; evaluate the number of initial runs the transaction has to make.
8. How does a query tree represent a relational algebra expression? What is meant by an execution of a query tree? Discuss the rules for transformation of query tree, and identify when each rule should be applied during optimization.
9. Query optimization is a misnomer. Explain
10. Consider the following S table from a students' database.