Presentation is loading. Please wait.

Presentation is loading. Please wait.

Query Processing.

Similar presentations


Presentation on theme: "Query Processing."— Presentation transcript:

1 Query Processing

2 Query Processing Query processing refers to the range of activities involved in extracting data from a database. Basic steps in query processing Parsing and translation Optimization Evaluation

3 Steps in Query Processing

4 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.

5 Optimization Optimizer will choose a lowest cost evaluation plan amoung all. Cost is estimated using statistical information from the database catalog. Eg: number of tuples in each relation, size of tuples etc. A relation algebra expression may have many equivalent expressions. balance<2500 ( balance (account)) is equivalent to balance ( balance<2500 (account))   Each relation algebra operation can be evaluated using one of several different algorithms. Correspondingly a relational – algebra expressions can be evaluated in many ways. Annotated expression specifying detailed evaluation strategy is called an evaluation plan. Eg: can use an index on balance to find accounts with balance <2500

6 Catalog information for cost estimation
A query optimizer, should not depend solely on heuristic rules. It should also estimate and compare the costs of executing a query using different execution strategies and should choose the strategy with the lower cost estimation.

7 Cost components for query execution
The cost of executing a query includes the following components Access cost to secondary storage Storage cost Computation cost Memory usage cost Communication cost

8 DATABASE TUNING

9 Database tuning Database tuning is the activity of making a database application run more quickly. Tuning is difficult because it requires global knowledge of an information system, from the hardware to the operating system to the transaction subsystem to the query language to the application.

10 The Goals of tuning database
To make applications run faster To lower the response time of queries and transactions To improve the overall throughput of transactions

11 DBMS can internally collect the following statistics:
Sizes of individual tables Number of distinct values in a column The number of times a particular query or transaction is submitted and executed in an interval of time The times required for different phases of query and transaction.

12 I/O tuning Hardware and software configuration of disk subsystems are examined DBMS tuning DBMS tuning refers to tuning of the DBMS and the configuration of the memory and processing resources of the computer running the DBMS. Database maintenance Database maintenance includes backups, column statistics updates, and defragmentation of data inside the database files.

13 Tuning of the database system parameters, as well as the higher level database design such as
Tuning of Hardware Tuning of the schema Tuning of indices Tuning of physical design Tuning of transactions


Download ppt "Query Processing."

Similar presentations


Ads by Google