A query processor is one of the major components of a relational database or an electronic database in which data is stored in tables of rows and columns. It complements the storage engine, which writes and reads data to and from storage media.
A user, or an applications program, interacts with the query processor and the query processor, in turn interacts with the storage engine. Essentially, the query processor receives an instruction or instructions written in Structured Query Language (SQL), chooses a plan for executing the instructions and carries out the plan.
The SQL syntax is transformed into a series of operations that can be performed on data and its indices. The raw query plan, as it is known, is optimized to make it more efficient before it is executed.
Effectively, a user specifies the result that he or she wants to achieve and the query processor determines how the result is achieved. In this way, the query processor separates the user from the unnecessary details of how a query is executed.