

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


B-Tree vs. B+-Tree Key differences: B-Tree intermediate nodes are able to contain pointers to raw data instead of just pointers to children. Each node in a B-Tree has a key value and two pointers, as opposed to the one pointer in a B+ tree. One pointer points to raw data (or null), and the other points to a child node (or null). B+-Trees benefit range queries by having leaf nodes chained together on the same level. Advantages of B
Lexicographical Ordering: <attribute 1,attribute 2> Use attribute 1 as the primary ordering key... row 1: <a1, b1> row 2: <a2, b2> if a1>a2 then row 1 > row 2 if a1<a2 then row 1< row 2 if a1=a2 then compare b1 and b There is a ranking order of all attributes in the vector. The primary ordering key has the highest rank, and each following attribute in the vector has a decreasing rank. Ranking order has a huge impact on the performance of queries. select * from Employee where B_date='10/08/65' and Salary=50k On purely equality-based queries like this, the order really has little effect. Either you traverse lower into the tree and scan less entries, or you traverse higher in the tree and scan more entries. select * from Employee where B_date='10/08/65' and Salary<50k For this query, it would be best to choose B_date as the primary ordering key, and Salary as secondary. This way, you can find people with a specific birthday, and traverse through their salaries. If it was done the other way around, you would search through all people with a salary of less than 50k, which would include people with birthdays you aren't looking for. select * from Employee where B_date<'10/08/65' and Salary=50k For this query, it would be best to choose Salary as the primary ordering key, and B_date as secondary. This way, you can find people with a specific salary, and traverse through their birthdays. If it was done the other way around, you would search through all people with a birthday of less than 10/08/65, which would include people with salaries you aren't looking for. A general rule regarding indexes: (A1,A2,.....,An)=T Queries that ask for a prefix of T (a subset of all elements in T) will benefit from a multi-key index. Application Development around Databases 3-Tier business architecture: Presentation Tier Translates computational tasks into a form that is friendly to a human user Web Server Logic Tier Logical decisions and commands based on data Application Server Data Tier Storage/Query processing of data DBMS