planner

package
v0.0.0-...-6719cd2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

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

func Parse(query *parser.Query, stats Stats, searchOpts search.Options) (*search.Space, error)

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.

Directories

Path Synopsis
Package plandef defines the output of the query planner.
Package plandef defines the output of the query planner.
Package search implements a generic query optimizer algorithm.
Package search implements a generic query optimizer algorithm.

Jump to

Keyboard shortcuts

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