Documentation ¶
Overview ¶
Package planner is the KG/Akutan-specific query optimizer. It defines the logical and physical transformation rules for KG/Akutan's logical and physical operators, and it leverages the search subpackage to find the best implementation plan. This package also implements KG/Akutan-specific cost predictions and defines the logical operators (physical operators are defined in the plan subpackage).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse is a lower-level interface for more control. It initializes a search space with the input query and returns the search space, which can be used to find an implementation plan. It returns an error if the query is malformed.
func Prepare ¶
func Prepare(ctx context.Context, query *parser.Query, stats Stats, searchOpts search.Options) (*search.Space, *plandef.Plan, error)
Prepare finds an implementation plan for the given query. It returns an error if the query is malformed or cannot be implemented. It returns both the search space that the plan was selected from, and the selected plan.
Types ¶
type Stats ¶
type Stats interface { // How many partitions the SPO key-space has been hashed across. NumSPOPartitions() int // How many partitions the POS key-space has been hashed across. NumPOSPartitions() int // The number of bytes of disk space used by a typical fact. BytesPerFact() int // The total number of facts. NumFacts() int // The number of facts with the given subject. The caller may pass 0 to ask for // the number of facts for a typical subject. NumFactsS(subject uint64) int // Similar to NumFactsS. NumFactsSP(subject uint64, predicate uint64) int // Similar to NumFactsS. NumFactsSO(subject uint64, object rpc.KGObject) int // Similar to NumFactsS. NumFactsP(predicate uint64) int // Similar to NumFactsS. NumFactsPO(predicate uint64, object rpc.KGObject) int // Similar to NumFactsS. NumFactsO(object rpc.KGObject) int }
Stats is used by the query planner to more accurately estimate costs.