db_utils

package
v1.283.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableIndexScanPercentageCheckHealthy    = "healthy"
	TableIndexScanPercentageCheckProblem    = "problem"
	TableIndexScanPercentageCheckEmptyTable = "empty_table"
)
View Source
const (
	IndexProblemReasonNeverUsedIndex              = "Never-used index"
	IndexProblemReasonLowScanHighWrite            = "Low scan, high write"
	IndexProblemReasonSeldomUsedLargeIndex        = "Seldom-used large index"
	IndexProblemReasonHighWriteLargeNonBTreeIndex = "High write, large non-BTree index"
)
View Source
const (
	LastXHours string = "^last \\d+ hour(s)?$"
	LastDay    string = "^last day$"
	LastXDays  string = "^last \\d+ day(s)?$"
	LastMonth  string = "^last month$"
	Yesterday  string = "^yesterday$"
)

Special query cases

View Source
const CorruptIndexQuery = `` /* 772-byte string literal not displayed */
View Source
const ExistingIndexQuery = `` /* 569-byte string literal not displayed */
View Source
const ProblemIndexQuery = `` /* 3289-byte string literal not displayed */
View Source
const TableIndexStatusQuery = `` /* 576-byte string literal not displayed */

Variables

This section is empty.

Functions

func AbsoluteDateStringQuery

func AbsoluteDateStringQuery(absolute string) (string, error)

func CheckAbsoluteRegex added in v1.275.0

func CheckAbsoluteRegex(regex string, value string) bool

func ParseAbsoluteQuery added in v1.282.0

func ParseAbsoluteQuery(absoluteQuery string, location *time.Location) (startDate, endDate time.Time, err error)

func PullAbsoluteValue added in v1.275.0

func PullAbsoluteValue(value string) int64

func ValidateDateFilters added in v1.251.0

func ValidateDateFilters(params any, dateFiltersToValidate ...string) error

Types

type CorruptIndex added in v1.276.0

type CorruptIndex struct {
	CheckResult  string `json:"check_result"` // If there are no errors, this should be empty.
	RelationName string `json:"relation_name"`
	RelationSize int64  `json:"relation_size"` // This size in measured in pages.
}

type Index added in v1.276.0

type Index struct {
	IndexName string `json:"index_name"`
	TableName string `json:"table_name"`
}

type IndexError added in v1.276.0

type IndexError struct {
	TableName string `json:"table_name"`
	IndexName string `json:"index_name"`
	Reason    string `json:"reason"`
}

type IndexHealthIssues added in v1.276.0

type IndexHealthIssues struct {
	CorruptIndexes     []CorruptIndex      `json:"corrupt_indexes"`
	LowIndexScanTables []LowIndexScanTable `json:"low_index_scan_tables"`
	ProblemIndexes     []ProblemIndex      `json:"problem_indexes"`
}

type LowIndexScanTable added in v1.276.0

type LowIndexScanTable struct {
	TableName    string `json:"table_name"`
	Status       string `json:"index_name"`
	PercentUsage int64  `json:"percent_usage"`
	RowsInTable  int64  `json:"rows_in_table"`
}

type PageAndOrderParams added in v1.274.0

type PageAndOrderParams struct {
	PageParams
	OrderBy string `json:"order_by,omitempty"`
	Order   string `json:"order,omitempty"`
}

type PageParams added in v1.251.0

type PageParams struct {
	Limit  int64 `json:"limit,omitempty"`  // Limit number of items returned in list (default: 0 (no limit))
	Offset int64 `json:"offset,omitempty"` // Offset in list (default: 0 (no offset))
}

func (*PageParams) EnforceLimit added in v1.251.0

func (params *PageParams) EnforceLimit()

func (*PageParams) Validate added in v1.251.0

func (params *PageParams) Validate() error

type ProblemIndex added in v1.276.0

type ProblemIndex struct {
	TableName           string  `json:"table_name"`
	IndexName           string  `json:"index_name"`
	Reason              string  `json:"reason"`
	IndexScanPercentage float64 `json:"index_scan_percentage"`
	IndexSize           string  `json:"index_size"`
	TableSize           string  `json:"table_size"`
}

func FindCommonNeverUsedIndexes added in v1.276.0

func FindCommonNeverUsedIndexes(list1, list2 []ProblemIndex) []ProblemIndex

Jump to

Keyboard shortcuts

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