Class PlanCost


  • public class PlanCost
    extends java.lang.Object
    This class holds a collection of values that represent the cost of an operation against the database. All of these cost estimates are ultimately based on statistics computed from actual tables, but the estimation process is very approximate. For more involved plans, the best we can really hope for is that better, faster plans will be assigned lower costs than worse, slower plans. Some of these values are floating-point values since they are affected by selectivity estimates, which are always between 0 and 1. Other values are cumulative (e.g. the number of block reads and large seeks), so they are represented as integer values.
    See Also:
    TableStats
    • Field Summary

      Fields 
      Modifier and Type Field Description
      float cpuCost
      An estimate of the overall computational cost of an operation, in some imaginary unit.
      long numBlockIOs
      The estimated number of disk-block accesses required to perform the operation.
      long numLargeSeeks
      The estimated number of large disk-seeks required to perform the operation.
      float numTuples
      The estimated number of tuples produced by the node.
      float tupleSize
      The average tuple size of tuples produced by the node.
    • Constructor Summary

      Constructors 
      Constructor Description
      PlanCost​(float numTuples, float tupleSize, float cpuCost, long numBlockIOs, long numLargeSeeks)
      Constructs a PlanCost object from its component fields.
      PlanCost​(PlanCost c)
      Constructs a PlanCost object from another cost object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • numTuples

        public float numTuples
        The estimated number of tuples produced by the node. We use a floating-point value because the computations frequently involve fractional numbers and it's not very effective to use integers or longs.
      • tupleSize

        public float tupleSize
        The average tuple size of tuples produced by the node.
      • cpuCost

        public float cpuCost
        An estimate of the overall computational cost of an operation, in some imaginary unit. Each plan node must perform some amount of computation to produce its results, and this cost is clearly accumulated as results flow up the plan tree.
      • numBlockIOs

        public long numBlockIOs
        The estimated number of disk-block accesses required to perform the operation.
      • numLargeSeeks

        public long numLargeSeeks
        The estimated number of large disk-seeks required to perform the operation.
    • Constructor Detail

      • PlanCost

        public PlanCost​(float numTuples,
                        float tupleSize,
                        float cpuCost,
                        long numBlockIOs,
                        long numLargeSeeks)
        Constructs a PlanCost object from its component fields.
        Parameters:
        numTuples - the estimated number of tuples that will be produced
        tupleSize - the estimated size of the produced tuples in bytes
        cpuCost - an estimate of the overall computational cost of the plan node, in some imaginary unit
        numBlockIOs - the estimated number of block reads and writes that will be performed in evaluating the query
        numLargeSeeks - the estimated number of large disk-seeks that will be performed in evaluating the query
      • PlanCost

        public PlanCost​(PlanCost c)
        Constructs a PlanCost object from another cost object.
        Parameters:
        c - the cost-object to duplicate
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object