1 / 6

Query Optimization Example

Query Optimization Example. Database Tables: Emp (name, age, sal , dno ) Dept ( dno , dname , floor, budget, mgr, ano ) Acnt ( ano,t ype , balance, bno ) Bank ( bno , bname,a ddress ). Query Q: select name, floor from emp , dept where emp.dno=dept.dno and sal >100K.

buffy
Download Presentation

Query Optimization Example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Query Optimization Example Database Tables: Emp (name, age, sal, dno) Dept (dno, dname, floor, budget, mgr, ano) Acnt (ano,type, balance, bno) Bank (bno, bname,address) Query Q: select name, floor from emp, dept where emp.dno=dept.dno and sal>100K. Source: Query Optimization, Y. E. Ioannidis, ACM Computing Surveys, 28(1), March 1996. System Catalog Information: Table Emp: 20,000 pages, 100,000 tuples, clustering B+tree index on emp.sal (3-levels) selectivity( salary > 100K) = 10 percent Table Dept: 10 pages, 100 tuples, clustering Hash-file on dept.dno (1.2 pages/bucket) Memory Buffer: 3 pages Disk I/O cost: 20 ms/page

  2. Algebraic Tree Transformations

  3. Dynamic Programming: Step 1 – Options at Leafs

  4. Step 2a – Options for Join – nested loop

  5. Step 2 – Options for Join

  6. Q? Compare queries Q and Q’ on • Query Result • Efficiency of query plans Query Q: select name, floor from emp, dept where emp.dno=dept.dno And job = “Sr. Programmer” Semantic Query Optimization Integrity Constraint: assert sal-constraint on emp: sal>100K where job = “Sr. Programmer” Query Q’: select name, floor from emp, dept where emp.dno=dept.dno and job = “Sr. Programmer” and sal>100K. System Catalog Information: Table Emp: 20,000 pages, 100,000 tuples, clustering B+tree index on emp.sal (3-levels) selectivity( salary > 100K) = 10 percent Table Dept: 10 pages, 100 tuples, clustering Hash-file on dept.dno (1.2 pages/bucket) Memory Buffer: 3 pages Disk I/O cost: 20 ms/page

More Related