{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch12_query_processing

# ch12_query_processing - Chapter 12 Query Processing Chapter...

This preview shows pages 1–8. Sign up to view the full content.

Chapter 12: Query Processing Chapter 12: Query Processing

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
©Silberschatz, Korth and Sudarshan 12.2 Database System Concepts - 6 th Edition Chapter 12: Query Processing Chapter 12: Query Processing Overview Measures of Query Cost Selection Operation Sorting Join Operation Other Operations Evaluation of Expressions
©Silberschatz, Korth and Sudarshan 12.3 Database System Concepts - 6 th Edition Basic Steps in Query Processing Basic Steps in Query Processing 1. Parsing and translation 2. Optimization 3. Evaluation

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
©Silberschatz, Korth and Sudarshan 12.4 Database System Concepts - 6 th Edition Basic Steps in Query Processing (Cont.) (Cont.) Parsing and translation translate the query into its internal form. This is then translated into relational algebra. Parser checks syntax, verifies relations Evaluation The query-execution engine takes a query-evaluation plan, executes that plan, and returns the answers to the query.
©Silberschatz, Korth and Sudarshan 12.5 Database System Concepts - 6 th Edition Basic Steps in Query Processing : Optimization Optimization A relational algebra expression may have many equivalent expressions E.g., σ salary < 75000 ( salary ( instructor)) is equivalent to salary ( σ salary < 75000 ( instructor)) Each relational algebra operation can be evaluated using one of several different algorithms Correspondingly, a relational-algebra expression can be evaluated in many ways. Annotated expression specifying detailed evaluation strategy is called an evaluation-plan . E.g., can use an index on salary to find instructors with salary < 75000, or can perform complete relation scan and discard instructors with salary 75000

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
©Silberschatz, Korth and Sudarshan 12.6 Database System Concepts - 6 th Edition Basic Steps: Optimization (Cont.) Basic Steps: Optimization (Cont.) Query Optimization : Amongst all equivalent evaluation plans choose the one with lowest cost. Cost is estimated using statistical information from the database catalog e.g. number of tuples in each relation, size of tuples, etc. In this chapter we study How to measure query costs Algorithms for evaluating relational algebra operations How to combine algorithms for individual operations in order to evaluate a complete expression In Chapter 14 We study how to optimize queries, that is, how to find an evaluation plan with lowest estimated cost
©Silberschatz, Korth and Sudarshan 12.7 Database System Concepts - 6 th Edition Measures of Query Cost Measures of Query Cost Cost is generally measured as total elapsed time for answering query Many factors contribute to time cost disk accesses, CPU , or even network communication Typically disk access is the predominant cost, and is also relatively easy to estimate. Measured by taking into account Number of seeks * average-seek-cost Number of blocks read * average-block-read-cost Number of blocks written * average-block-write-cost Cost to write a block is greater than cost to read a block data is read back after being written to ensure that the write was successful

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern