simpledb.metadata
Class IndexInfo

java.lang.Object
  extended by simpledb.metadata.IndexInfo

public class IndexInfo
extends Object

The information about an index. This information is used by the query planner in order to estimate the costs of using the index, and to obtain the schema of the index records. It's methods are essentially the same as those of Plan.

Author:
Edward Sciore

Constructor Summary
IndexInfo(String idxname, String tblname, String fldname, Transaction tx)
          Creates an IndexInfo object for the specified index.
 
Method Summary
 int blocksAccessed()
          Estimates the number of block accesses required to find all index records having a particular search key.
 int distinctValues(String fname)
          Returns the distinct values for a specified field in the underlying table, or 1 for the indexed field.
 Index open()
          Opens the index described by this object.
 int recordsOutput()
          Returns the estimated number of records having a search key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexInfo

public IndexInfo(String idxname,
                 String tblname,
                 String fldname,
                 Transaction tx)
Creates an IndexInfo object for the specified index.

Parameters:
idxname - the name of the index
tblname - the name of the table
fldname - the name of the indexed field
tx - the calling transaction
Method Detail

open

public Index open()
Opens the index described by this object.

Returns:
the Index object associated with this information

blocksAccessed

public int blocksAccessed()
Estimates the number of block accesses required to find all index records having a particular search key. The method uses the table's metadata to estimate the size of the index file and the number of index records per block. It then passes this information to the traversalCost method of the appropriate index type, which provides the estimate.

Returns:
the number of block accesses required to traverse the index

recordsOutput

public int recordsOutput()
Returns the estimated number of records having a search key. This value is the same as doing a select query; that is, it is the number of records in the table divided by the number of distinct values of the indexed field.

Returns:
the estimated number of records having a search key

distinctValues

public int distinctValues(String fname)
Returns the distinct values for a specified field in the underlying table, or 1 for the indexed field.

Parameters:
fname - the specified field


Copyright © 2011. All Rights Reserved.