Database Management Systems (2130703)

BE | Semester-3   Summer-2018 | 05/23/2018

Q4) (c)

Explain steps of query processing with the help of neat diagram.

Query processing

  • It is a process of transforming a high level query (such as SQL) in to low level language.
  • Query processing refers to the range of activities involved in extracting data from a database.
Query processing
  • A query expressed in a high level query language such as SQL must be
    • Scanned
    • Parsed
    • Validated
  • The scanner identifies the language tokens such as SQL keywords, attribute names and relation names in the text of the query.
  • Parser checks the query syntax to determine whether it is formulated according to the syntax rules of the query language.
  • The query must also be validated by checking that all attributes and relation names are valid and semantically meaningful names in the schema of the particular database being queried.
  • A query typically has many possible execution strategies and the process of choosing a suitable one for processing a query is known as query optimization.
  • The query optimizer module has the task of producing an execution plan and code generator generates the code to execute that plan.
  • The runtime database processor has the task of running the query code whether in compiled or interpreted mode, to produce the query result.
  • If a runtime error results, an error message is generated by the runtime database processor.
  • Query code generator will generate code for query.
  • Runtime database processor will select optimal plan and execute query and gives result.