Recursive query optimization

Certain applications and data are recursive by nature. Examples of such applications are a bill-of-material, reservation, trip planner, or networking planning system. Data in one results row has a natural relationship (call it a parent, child relationship) with data in another row or rows. The kinds of recursion implemented in these systems can be performed by using SQL Stored Procedures and temporary results tables. However, the use of a recursive query to facilitate the access of this hierarchical data can lead to a more elegant and better performing application.

Recursive queries can be implemented by defining either a Recursive Common Table Expression (RCTE) or a Recursive View.