Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Database Engine


Published on

  • Be the first to comment

  • Be the first to like this

Database Engine

  1. 1. Data Structures & DatabaseDatabase EngineSearch AlgorithmsBinary TreesB-TreesIndexes
  2. 2. Database Engine Bike Engine (With Gears) Database EngineStart your bike engine Start your database engine. Create database objects and runChange gears to 1st and drive the bike. applications.What happens to bike engine if we don’t What happens if we don’t changes gearschange gears? in database? Gears in database???I need to go fast now. I need to get fast results.You change gears the from 1st to 2nd and Change gears of a database engine.3rd as you would like to go fast. ???  don’t have gears in database. WeDead Engine  Very slow and dead applications. Root cause: Bad bike rider - User Root cause: Poor database user.
  3. 3. Search AlgorithmsLet’s go through 2 Algorithms• Sequential Search• Binary SearchDatabase Plans• Scans• Seeks
  4. 4. Sequential SearchLinear search or Sequential search is a method for finding aparticular value in a list, that consists of checking every one ofits elements, one at a time and in sequence, until the desiredone is found.Set i to 1.Repeat this loop: If i > n, then exit the loop. If A[i] = x, then exit the loop.Set i to i + 1.Return i.
  5. 5. Binary Search• Binary Search or Half-interval search algorithm locates the position of an item in a sortedarray.Binary search works by comparing an input value to the middle element of the array. The comparison determines whether the element equals the input, less than the input or greater. When the element being compared to equals the input the search stops and typically returns the position of the element. If the element is not equal to the input then a comparison is made to determine whether the input is less than or greater than the element. Depending on which it is the algorithm then starts over but only searching the top or bottom subset of the arrays elements. If the input is not located within the array the algorithm will usually output a unique value indicating this.
  6. 6. Binary Trees• A binary tree is a tree data structure in which each node has at most two child nodes, usually distinguished as "left" and "right". Nodes with children are parent nodes, and child nodes may contain references to their parents. Outside the tree, there is often a reference to the "root" node (the ancestor of all nodes), if it exists. Any node in the data structure can be reached by starting at root node and repeatedly following references to either the left or right child.
  7. 7. B-TreesB-tree is a tree data structure that keeps data sorted and allowssearches, sequential access, insertions, and deletions. The B-tree is ageneralization of a binary search tree in that a node can have more thantwo children. Unlike self-balancing binary search trees, the B-tree isoptimized for systems that read and write large blocks of data. It iscommonly used in databases and filesystems.
  8. 8. B-Trees
  9. 9. Index (Database)A database index is a data structure that improves the speed of dataretrieval operations on a database table at the cost of slower writes andincreased storage space. Indexes can be created using one ormore columns of a database table, providing the basis for both rapidrandom lookups and efficient access of ordered records. The disk spacerequired to store the index is typically less than that required by the table(since indexes usually contain only the key-fields according to which thetable is to be arranged, and exclude all the other details in thetable), yielding the possibility to store indexes in memory for a tablewhose data is too large to store in memory.
  10. 10. Questions?