Define access path. Write the formula to calculate the cost of searching algorithm selections using indices.

  • A search algorithm that makes use of an index is called an index scan and the index structure is called an access path.
  •  An access path specifies the path chosen by a database management system to retrieve the requested tuples from a relation. 
  • The description of an externally described file contains the access path that describes how records are to be retrieved from the file. Records can be retrieved based on an arrival sequence (non-keyed) access path or on a keyed-sequence access path. OR,
  •  Access Path refers to the path chosen by the system to retrieve data after a structured query language (SQL) request is executed. A query may request at least one variable to be filled up with one value or more.

The formula to calculate the cost of searching algorithm selections using indices

  • A1 (primary index, equality on key): For an equality comparison on a key attribute with a primary index, we can use the index to retrieve a single record that satisfies the corresponding equality condition. 
Cost = (hi + 1) x (tr+ ts), where hi is the height of the index.

  • A2 (primary index, equality on non-key): For an equality comparison on a non-key attribute with a primary index, we can use the index to retrieve multiple records (possibly spread over b successive blocks) that satisfy the corresponding equality condition. 
Cost=hi x (tr+ts) + ts+trx b, where he is the height of the index.

  • A3  (secondary index, equality): Selection specifying an equality condition can use a secondary index. This strategy can retrieve if the indexing field is not a key. Retrieve a single record if the search key is a candidate key 
 Cost (hi + 1) x (tr + ts), where he is the height of the index. Retrieve multiple records if the search key is not a candidate key each of n matching records may be on a different block.

Cost (hi+n) x (tr + ts), where hi is the height of the index. For the large number of blocks n with matching records, this can be very expensive and cost even more than a linear scan!



Comments

Popular posts from this blog

What are different steps used in JDBC? Write down a small program showing all steps.

Discuss classification or taxonomy of virtualization at different levels.

Pure Versus Partial EC