H.S.Bhathiya edited section_Query_Optimization_and_Execution__.tex  about 8 years ago

Commit id: 9fcbc837ad468ea1fde5ea6f0b14230618682e29

deletions | additions      

       

\section{Query Optimization and Execution Plans}  Query optimization is one of the most important role in relational databases. Almost all the relational database systems such as MySQL, Postgres, Oracle DB, Apache Derby consist of query optimizers.   \subsubsection{Join \subsection{Join  Query Execution Plans} Consider query   SELECT * FROM A \\  JOIN B ON A.ID = B.ID \\  JOIN C ON A.ID = C.ID \\  JOIN D ON A.ID = D.ID \\    Possible Two possible  execution plans are shown deep-left tree (shown  in Figure-1 )  and Figure-2 Bushy Tree (shown in Figure -2)  \subsection{Challenegs in Bushy Tree Implementation}  Moving from left-deep tree to a Bushy tree is a challenge as the number of possible structures in bushy trees are much larger. Left-deep trees have only one structure regardless of the number of attributes involved. Therefor the number of possible permutations are N! . But for bushy trees possible number of structures are given by   $$ S(N) = 1 if $N = 1 $ \\   S(N) = $\displaystyle \sum_{N=1}^{i} (N)(N-i)$ if N > 1 $$\\  Therefore the number of possible permutations are $S(N)*N!$. Unlike left-deep tree case, estimating the cost for all the possible bushy trees is computationally infeasible for moderately large N. N (~7).  Therefore it is required to come with a heuristic to select set of permutations for cost computations.Some heuristics considered are computations.  \subsection{Heuristics to Select Bushy Trees}  \textit{QUIKPICK-1000}  Here we build pseudo-random joining trees . This approach can build trees very fast and