Documentation ¶
Index ¶
- Constants
- Variables
- func HasCostFlag(costFlag, flag uint64) bool
- func TraceCost(option *optimizetrace.PlanCostOption) bool
- type CostTrace
- type CostVer2
- func DivCostVer2(cost CostVer2, denominator float64) (ret CostVer2)
- func MulCostVer2(cost CostVer2, scale float64) (ret CostVer2)
- func NewCostVer2(option *optimizetrace.PlanCostOption, factor CostVer2Factor, cost float64, ...) (ret CostVer2)
- func NewZeroCostVer2(trace bool) (ret CostVer2)
- func SumCostVer2(costs ...CostVer2) (ret CostVer2)
- type CostVer2Factor
Constants ¶
const ( // CostFlagRecalculate indicates the optimizer to ignore cached cost and recalculate it again. CostFlagRecalculate uint64 = 1 << iota // CostFlagUseTrueCardinality indicates the optimizer to use true cardinality to calculate the cost. CostFlagUseTrueCardinality // CostFlagTrace indicates whether to trace the cost calculation. CostFlagTrace )
Variables ¶
var ZeroCostVer2 = NewZeroCostVer2(false)
ZeroCostVer2 is a pre-defined zero CostVer2.
Functions ¶
func HasCostFlag ¶
HasCostFlag indicates whether the costFlag has the flag.
func TraceCost ¶
func TraceCost(option *optimizetrace.PlanCostOption) bool
TraceCost indicates whether to trace cost.
Types ¶
type CostTrace ¶
type CostTrace struct {
// contains filtered or unexported fields
}
CostTrace record the basic factor and formula in cost est.
func (*CostTrace) GetFactorCosts ¶
GetFactorCosts return the factors of current costTrace.
func (*CostTrace) GetFormula ¶
GetFormula return the formula of current costTrace.
type CostVer2 ¶
type CostVer2 struct {
// contains filtered or unexported fields
}
CostVer2 is a structure of cost basic of version2
func DivCostVer2 ¶
DivCostVer2 is div utility func of CostVer2.
func MulCostVer2 ¶
MulCostVer2 is mul utility func of CostVer2.
func NewCostVer2 ¶
func NewCostVer2(option *optimizetrace.PlanCostOption, factor CostVer2Factor, cost float64, lazyFormula func() string) (ret CostVer2)
NewCostVer2 is the constructor of CostVer2.
func NewZeroCostVer2 ¶
NewZeroCostVer2 return a new zero costVer2.
func SumCostVer2 ¶
SumCostVer2 sum the cost up of all the passed args.
type CostVer2Factor ¶
CostVer2Factor is a record of internal cost factor.
func (CostVer2Factor) String ¶
func (f CostVer2Factor) String() string
String return the current CostVer2Factor's format string.