Ticker

6/recent/ticker-posts

Query processing and steps to process high level query

 

Query processing and steps to process high level query

Query processing is transformed the high level query into low level expression is called query processing.In query processing number of steps that are followed to convert high level query into low level expression.Steps in high level query processing is

  • Scanning and parsing and validating.
  • Query optimizer.
  • Query code generator.
  • Runtime database processor.

Query in high level language⟶Scanning and parsing and validating⟶Immediate form of query⟶Query optimizer⟶Execution plan⟶Query code generator⟶Code to execute the query⟶Runtime database processor⟶Result of query.

A query expressed in high level query language such as SQL must first scanned parsed and validate.The scanner identifies the query tokens such as SQL keywords and attribute name etc whereas  parser checks the query syntax to determine whether it is formulated according to the syntax rules of the query language.The query also be validated by checking that all attribute and relation names are valid and semantically meaningful names in the schema of the database being queried. An internal representation of the query is then created as a tree data structure called a query tree. 

A query has many possible execution strategies and the process of choosing a suitable one for processing a query is known as query optimization.Optimization techniques that apply heuristic rules to modify the internal representation of a query.The query optimizer module has the task of producing  a good execution plans.The oracle database provides two different approaches to query optimization first one is rule based and other is cost based.In rule based approach the optimizer choose execution plans based on heuristically ranked operations.In cost based approach optimizer examines alternative access paths and operator algorithms and choose the execution plan with the lowest estimated cost.The oracle optimizer calculates this cost based on the estimated usage of resources such as I/O,CPU time and memory needed.The goal of cost based optimization in oracle is to minimize the elapsed time to process the entire query.

Code generator generates the code to execute the 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.

Follow all these steps get the result of query. 

                    





Post a Comment

0 Comments