costusage

package
v1.1.0-beta.0...-04608f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var ZeroCostVer2 = NewZeroCostVer2(false)

ZeroCostVer2 is a pre-defined zero CostVer2.

Functions

func HasCostFlag

func HasCostFlag(costFlag, flag uint64) bool

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

func (c *CostTrace) GetFactorCosts() map[string]float64

GetFactorCosts return the factors of current costTrace.

func (*CostTrace) GetFormula

func (c *CostTrace) GetFormula() string

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

func DivCostVer2(cost CostVer2, denominator float64) (ret CostVer2)

DivCostVer2 is div utility func of CostVer2.

func MulCostVer2

func MulCostVer2(cost CostVer2, scale float64) (ret CostVer2)

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

func NewZeroCostVer2(trace bool) (ret CostVer2)

NewZeroCostVer2 return a new zero costVer2.

func SumCostVer2

func SumCostVer2(costs ...CostVer2) (ret CostVer2)

SumCostVer2 sum the cost up of all the passed args.

func (*CostVer2) GetCost

func (c *CostVer2) GetCost() float64

GetCost returns the cost value of the costVer2

func (*CostVer2) GetTrace

func (c *CostVer2) GetTrace() *CostTrace

GetTrace returns the trace of current costVer2

type CostVer2Factor

type CostVer2Factor struct {
	Name  string
	Value float64
}

CostVer2Factor is a record of internal cost factor.

func (CostVer2Factor) String

func (f CostVer2Factor) String() string

String return the current CostVer2Factor's format string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL