Database Management System: Unit IV: Implementation Techniques

Measure of Query Cost

Implementation Techniques - Database Management System

There are multiple possible evaluation plans for a query, and it is important to be able to compare the alternatives in terms of their estimated cost and choose the best plan.

Measure of Query Cost

AU: Dec.-19, Marks 3

There are multiple possible evaluation plans for a query, and it is important to be able to compare the alternatives in terms of their estimated cost and choose the best plan.

There are many factors that contribute to query cost are -

  • Disk access

  • CPU time to execute the query

  • Cost of communication in distributed and parallel database system.

The cost of access data from disk is an important cost. Normally disk access is relatively slow as compared to in-memory operations. Moreover, the CPU speed is much faster than the disk speed. Hence the time spent in disk is relatively dominant factor in query execution.

Computing CPU access time is comparatively harder, hence we will not consider the CPU time to execute the query.

Similarly the cost of communication does not matter for simple large databases ero present in the centralized database system.

Typically disk access is the predominant cost and is also relatively easy to estimate, 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 because data is read back after being written to ensure that the write was successful.

We use number of block transfers from disk and number of disk seeks to estimate the Query cost.

Let,

  • b be the number to blocks

  • S be the number of Seeks

  • tT is average time required to transfer a block of data, in seconds

  • tS is average block access time in seconds.

Then query cost can be computed using following formula b*tr+S*ts

Database Management System: Unit IV: Implementation Techniques : Tag: : Implementation Techniques - Database Management System - Measure of Query Cost