stats

package
v1.49.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package stats provides statistics tracking for FDW query operations.

This package collects query execution statistics including cost metrics, row counts, and result widths using quantile streams. The statistics are used to generate accurate EXPLAIN plans and help the Postgres query planner make better decisions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Package

type Package struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Package collects query execution statistics for a specific table and operation. It uses quantile streams to track cost, row count, and result width metrics.

func NewPackage

func NewPackage(table, operation string) *Package

NewPackage creates a new statistics package for a table and operation.

func (*Package) AddSample

func (p *Package) AddSample(cost float32, rows uint)

AddSample records a cost and row count sample from a query execution.

func (*Package) AddWidthSample

func (p *Package) AddWidthSample(width uint)

AddWidthSample records a result width sample.

func (*Package) Explain

func (p *Package) Explain() string

Explain generates an EXPLAIN plan string using collected statistics. If no samples have been collected, returns a default plan. TODO(jschorr): Support getting cost estimates from Materialize.

Jump to

Keyboard shortcuts

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