pgcompare

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(data ReportData, outPath string) error

func NewBenchmark

func NewBenchmark(log *slog.Logger, dsn string) (*benchmark, error)

func NewDockerComparator

func NewDockerComparator(log *slog.Logger, cfg *Config) (*dockerComparator, error)

Types

type BenchResult

type BenchResult struct {
	Phase string
	Stats []Stats
	Plans []*PlanNode
}

type Config

type Config struct {
	ProjectDir string

	Migration struct {
		EnvVar        string `yaml:"env_var"`
		BeforeVersion string `yaml:"before_version"`
		AfterVersion  string `yaml:"after_version"`
	} `yaml:"migration"`

	Setup struct {
		Command string `yaml:"command"`
	} `yaml:"setup"`

	Benchmark struct {
		BeforeQueries string `yaml:"before_queries"`
		AfterQueries  string `yaml:"after_queries"`
		Iterations    int    `yaml:"iterations"`
		Concurrency   int    `yaml:"concurrency"`
	} `yaml:"benchmark"`

	Report struct {
		Description []DescriptionEntry `yaml:"description"`
	} `yaml:"report"`

	DSN string
}

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

type DescriptionEntry added in v1.0.0

type DescriptionEntry struct {
	Query    string `yaml:"query"`
	What     string `yaml:"what"`
	Changes  string `yaml:"changes"`
	Expected string `yaml:"expected"`
}

type PlanDiff

type PlanDiff struct {
	QueryName string
	Before    *PlanNode
	After     *PlanNode
	Summary   []string
}

type PlanNode

type PlanNode struct {
	NodeType        string
	RelationName    string
	IndexName       string
	ActualRows      float64
	ActualTotalTime time.Duration
	Children        []*PlanNode
}

type Query

type Query struct {
	Name string
	SQL  string
}

type ReportData

type ReportData struct {
	GeneratedAt time.Time
	Iterations  int
	Concurrency int
	Speedups    []float64
	Before      *BenchResult
	After       *BenchResult
	Diffs       []PlanDiff
	Description []DescriptionEntry
}

type Stats

type Stats struct {
	QueryName                             string
	Min, Max, P50, P95, P99, Mean, StdDev time.Duration
	QPS                                   float64
	ErrorRate                             float64
	Errors                                []string
}

Jump to

Keyboard shortcuts

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