1 / 4

Query Optimization Highlights

Query Optimization Highlights. Chapter 16 (intro), 16.1 (skim), 16.2 (skim). Naïve Query Processing. SELECT LNAME FROM EMPLOYEE, DEPARTMENT WHERE DNO=DNUMBER AND SALARY>45000 AND DNAME="Software Support"; Naively, this is 1 Cartesian product, followed by 3 selects, followed by one project.

king
Télécharger la présentation

Query Optimization Highlights

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 Highlights Chapter 16 (intro), 16.1 (skim), 16.2 (skim)

  2. Naïve Query Processing SELECT LNAME FROM EMPLOYEE, DEPARTMENT WHERE DNO=DNUMBER AND SALARY>45000 AND DNAME="Software Support"; Naively, this is 1 Cartesian product, followed by 3 selects, followed by one project. Query tree is drawn from bottom up.

  3. Optimization • The Query Processor might actually execute this as 2 selects, a join, a select and a project. • A smarter optimizer might do additional projects. • Seem intuitive? It's really intuitive only for the smallest queries. • Execution strategy is a plan for getting the result of a query. • Query optimization means finding the best execution strategy.

  4. Helpful Ideas • Reduce table size before joins: • Push selects and projects as far down the tree as possible • Do joins and C.P.s as late as possible • Do operations in decreasing order of selectivity (if known) • DBMS might keep profile information • Combine single-table operations when possible • Use secondary indexes to advantage

More Related