querycheck

package
v0.0.0-...-efe2ce5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddQueryRequest

type AddQueryRequest struct {
	Name       string `json:"name"`
	Query      string `json:"query"`
	CheckEvery int64  `json:"check_every_ms"`
}

type JIT

type JIT struct {
	Functions int     `json:"Functions"`
	Options   Options `json:"Options"`
	Timing    Timing  `json:"Timing"`
}

type Options

type Options struct {
	Inlining     bool `json:"Inlining"`
	Optimization bool `json:"Optimization"`
	Expressions  bool `json:"Expressions"`
	Deforming    bool `json:"Deforming"`
}

type Plan

type Plan struct {
	NodeType            string   `json:"Node Type"`
	ParallelAware       bool     `json:"Parallel Aware"`
	AsyncCapable        bool     `json:"Async Capable"`
	StartupCost         float64  `json:"Startup Cost"`
	TotalCost           float64  `json:"Total Cost"`
	PlanRows            int      `json:"Plan Rows"`
	PlanWidth           int      `json:"Plan Width"`
	ActualStartupTime   float64  `json:"Actual Startup Time"`
	ActualTotalTime     float64  `json:"Actual Total Time"`
	ActualRows          int      `json:"Actual Rows"`
	ActualLoops         int      `json:"Actual Loops"`
	Output              []string `json:"Output"`
	SharedHitBlocks     int      `json:"Shared Hit Blocks"`
	SharedReadBlocks    int      `json:"Shared Read Blocks"`
	SharedDirtiedBlocks int      `json:"Shared Dirtied Blocks"`
	SharedWrittenBlocks int      `json:"Shared Written Blocks"`
	LocalHitBlocks      int      `json:"Local Hit Blocks"`
	LocalReadBlocks     int      `json:"Local Read Blocks"`
	LocalDirtiedBlocks  int      `json:"Local Dirtied Blocks"`
	LocalWrittenBlocks  int      `json:"Local Written Blocks"`
	TempReadBlocks      int      `json:"Temp Read Blocks"`
	TempWrittenBlocks   int      `json:"Temp Written Blocks"`
	IOReadTime          float64  `json:"I/O Read Time"`
	IOWriteTime         float64  `json:"I/O Write Time"`
	Plans               []Plan   `json:"Plans,omitempty"`
	ParentRelationship  string   `json:"Parent Relationship,omitempty"`
	SortKey             []string `json:"Sort Key,omitempty"`
	SortMethod          string   `json:"Sort Method,omitempty"`
	SortSpaceUsed       int      `json:"Sort Space Used,omitempty"`
	SortSpaceType       string   `json:"Sort Space Type,omitempty"`
	WorkersPlanned      int      `json:"Workers Planned,omitempty"`
	WorkersLaunched     int      `json:"Workers Launched,omitempty"`
	SingleCopy          bool     `json:"Single Copy,omitempty"`
	RelationName        string   `json:"Relation Name,omitempty"`
	Schema              string   `json:"Schema,omitempty"`
	Alias               string   `json:"Alias,omitempty"`
	Filter              string   `json:"Filter,omitempty"`
	RowsRemovedByFilter int      `json:"Rows Removed by Filter,omitempty"`
	Workers             []Worker `json:"Workers,omitempty"`
}

func (*Plan) HasSameStructureAs

func (p *Plan) HasSameStructureAs(other Plan) bool

func (*Plan) String

func (p *Plan) String(i int) string

type Planning

type Planning struct {
	SharedHitBlocks     int     `json:"Shared Hit Blocks"`
	SharedReadBlocks    int     `json:"Shared Read Blocks"`
	SharedDirtiedBlocks int     `json:"Shared Dirtied Blocks"`
	SharedWrittenBlocks int     `json:"Shared Written Blocks"`
	LocalHitBlocks      int     `json:"Local Hit Blocks"`
	LocalReadBlocks     int     `json:"Local Read Blocks"`
	LocalDirtiedBlocks  int     `json:"Local Dirtied Blocks"`
	LocalWrittenBlocks  int     `json:"Local Written Blocks"`
	TempReadBlocks      int     `json:"Temp Read Blocks"`
	TempWrittenBlocks   int     `json:"Temp Written Blocks"`
	IOReadTime          float64 `json:"I/O Read Time"`
	IOWriteTime         float64 `json:"I/O Write Time"`
}

type Query

type Query struct {
	Name         string
	Query        string
	LatestPlan   *QueryPlan
	PreviousPlan *QueryPlan
	LastChecked  time.Time
	LastError    error
	CheckEvery   time.Duration
	// contains filtered or unexported fields
}

Query is a query to check

func (*Query) RecordPlanMetrics

func (qu *Query) RecordPlanMetrics(qp QueryPlan)

RecordPlanMetrics records the query plan metrics

func (*Query) RecordPlanNode

func (qu *Query) RecordPlanNode(p Plan)

RecordPlanNode records the query plan node metrics

type QueryPlan

type QueryPlan struct {
	Plan            Plan     `json:"Plan"`
	QueryIdentifier int64    `json:"Query Identifier"`
	Planning        Planning `json:"Planning"`
	PlanningTime    float64  `json:"Planning Time"`
	Triggers        []string `json:"Triggers"`
	JIT             JIT      `json:"JIT"`
	ExecutionTime   float64  `json:"Execution Time"`
}

func (*QueryPlan) HasSameStructureAs

func (q *QueryPlan) HasSameStructureAs(other QueryPlan) bool

func (*QueryPlan) String

func (q *QueryPlan) String() string

type QueryPlans

type QueryPlans []QueryPlan

type Querychecker

type Querychecker struct {
	Queries []*Query
	Logger  *slog.Logger
	// contains filtered or unexported fields
}

Querychecker is a query checker meta object

func NewQuerychecker

func NewQuerychecker(ctx context.Context, connectionURL string) (*Querychecker, error)

NewQuerychecker creates a new querychecker

func (*Querychecker) AddQuery

func (q *Querychecker) AddQuery(ctx context.Context, name, query string, checkEvery time.Duration)

AddQuery adds a query to the checker

func (*Querychecker) CheckQueryPlan

func (q *Querychecker) CheckQueryPlan(ctx context.Context, query string) (*QueryPlan, error)

CheckQueryPlan checks the query plan for a given query

func (*Querychecker) GetQueries

func (q *Querychecker) GetQueries(ctx context.Context) []*Query

GetQueries returns a copy of the queries

func (*Querychecker) GetQuery

func (q *Querychecker) GetQuery(ctx context.Context, name string) *Query

GetQuery returns a copy of the query

func (*Querychecker) HandleAddQuery

func (q *Querychecker) HandleAddQuery(c echo.Context) error

func (*Querychecker) HandleDeleteQuery

func (q *Querychecker) HandleDeleteQuery(c echo.Context) error

func (*Querychecker) HandleGetQueries

func (q *Querychecker) HandleGetQueries(c echo.Context) error

func (*Querychecker) HandleGetQuery

func (q *Querychecker) HandleGetQuery(c echo.Context) error

func (*Querychecker) HandleUpdateQuery

func (q *Querychecker) HandleUpdateQuery(c echo.Context) error

func (*Querychecker) RemoveQuery

func (q *Querychecker) RemoveQuery(ctx context.Context, name string)

RemoveQuery removes a query from the checker

func (*Querychecker) Start

func (q *Querychecker) Start() error

Start starts the query checker routines

func (*Querychecker) Stop

func (q *Querychecker) Stop()

Stop stops the query checker routines

func (*Querychecker) UpdateQuery

func (q *Querychecker) UpdateQuery(ctx context.Context, name, query string, checkEvery time.Duration)

UpdateQuery updates a query

type RetQuery

type RetQuery struct {
	Name         string     `json:"name"`
	Query        string     `json:"query"`
	LatestPlan   *QueryPlan `json:"latest_plan"`
	PreviousPlan *QueryPlan `json:"previous_plan"`
	LastChecked  time.Time  `json:"last_checked"`
	LastError    error      `json:"last_error"`
	CheckEvery   string     `json:"check_every"`
}

type Timing

type Timing struct {
	Generation   float64 `json:"Generation"`
	Inlining     float64 `json:"Inlining"`
	Optimization float64 `json:"Optimization"`
	Emission     float64 `json:"Emission"`
	Total        float64 `json:"Total"`
}

type UpdateQueryRequest

type UpdateQueryRequest struct {
	Query      string `json:"query"`
	CheckEvery int64  `json:"check_every_ms"`
}

type Worker

type Worker struct {
	WorkerNumber        int     `json:"Worker Number"`
	ActualStartupTime   float64 `json:"Actual Startup Time"`
	ActualTotalTime     float64 `json:"Actual Total Time"`
	ActualRows          int     `json:"Actual Rows"`
	ActualLoops         int     `json:"Actual Loops"`
	JIT                 JIT     `json:"JIT"`
	SharedHitBlocks     int     `json:"Shared Hit Blocks"`
	SharedReadBlocks    int     `json:"Shared Read Blocks"`
	SharedDirtiedBlocks int     `json:"Shared Dirtied Blocks"`
	SharedWrittenBlocks int     `json:"Shared Written Blocks"`
	LocalHitBlocks      int     `json:"Local Hit Blocks"`
	LocalReadBlocks     int     `json:"Local Read Blocks"`
	LocalDirtiedBlocks  int     `json:"Local Dirtied Blocks"`
	LocalWrittenBlocks  int     `json:"Local Written Blocks"`
	TempReadBlocks      int     `json:"Temp Read Blocks"`
	TempWrittenBlocks   int     `json:"Temp Written Blocks"`
	IOReadTime          float64 `json:"I/O Read Time"`
	IOWriteTime         float64 `json:"I/O Write Time"`
}

Jump to

Keyboard shortcuts

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