dba

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TableBloatQuery

func TableBloatQuery(minPercentBloat int) string

TableBloatQuery returns the query to run to check for table bloat. Taken from: https://raw.githubusercontent.com/pgexperts/pgx_scripts/master/bloat/table_bloat_check.sql

Types

type DBA

type DBA struct {
	// contains filtered or unexported fields
}

DBA is an automatic database administrator.

func New

func New(connStr string, opts Options) *DBA

New creates a new DBA and returns it

func (*DBA) Run

func (dba *DBA) Run() error

Run runs the automatic DBA

type Options

type Options struct {
	PreAnalyze     bool
	AnalyzeTimeout time.Duration
	PostAnalyze    bool

	BloatQueryTimeout time.Duration

	PreVacuum    bool
	VacuumTimout time.Duration

	FullVacuumBloatPercent   int           // Only consider tables with bloat larger than this percent to need a full vacuum
	FullVacuumMaxTableSizeMb int           // Do not vacuum tables larger than this size due to the amount of time it would take
	FullVacuumTimeout        time.Duration // Cancel full vacuum's that take longer than this many seconds

	Timeout time.Duration // Default timeout for everything else
	Verbose bool
}

Options controll how the DBA determines what to do

func NewDefaultOptions

func NewDefaultOptions() Options

NewDefaultOptions returns new Options initilized with our reasonable defaults

type TableBloatResult

type TableBloatResult struct {
	DatabaseName  string
	SchemaName    string
	TableName     string
	CanEstimate   bool
	EstimatedRows int
	PercentBloat  int
	MbBloat       float64
	TableMb       float64
}

TableBloatResult returns the results of checking table bloat

Jump to

Keyboard shortcuts

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