h004

package
v0.0.0-...-b15899e Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const H004_REDUNDANT_INDEXES_FOUND string = "H004_REDUNDANT_INDEXES_FOUND"
View Source
const H004_REDUNDANT_INDEXES_FOUND_DO string = "H004_REDUNDANT_INDEXES_FOUND_DO"
View Source
const H004_REDUNDANT_INDEXES_FOUND_P2 string = "H004_REDUNDANT_INDEXES_FOUND_P2"
View Source
const H004_REDUNDANT_INDEXES_FOUND_P3 string = "H004_REDUNDANT_INDEXES_FOUND_P3"
View Source
const H004_REDUNDANT_INDEXES_FOUND_UNDO string = "H004_REDUNDANT_INDEXES_FOUND_UNDO"
View Source
const MSG_REDUNDANT_INDEXES_FOUND_DO string = "\"DO\" database migrations  \n%s"
View Source
const MSG_REDUNDANT_INDEXES_FOUND_P2_CONCLUSION string = "[P2] %d redundant index(es) have been found and their total size " +
	"exceeds %.2f%% of the database size."
View Source
const MSG_REDUNDANT_INDEXES_FOUND_P3_CONCLUSION string = "[P3] %d redundant index(es) have been found."
View Source
const MSG_REDUNDANT_INDEXES_FOUND_R1 string = "Use the database migration provided below to drop the redundant indexes. " +
	"Keep in mind, that under load, it is recommended to use `DROP INDEX CONCURRENTLY` (and `CREATE INDEX CONCURRENTLY` " +
	"if reverting is needed) to avoid blocking issues."
View Source
const MSG_REDUNDANT_INDEXES_FOUND_R2 string = "Be careful dropping the indexes. If you have multiple setups of your " +
	"software, the analysis of just a single setup might be not enough. Some indexes might be used (and therefore, needed) " +
	"only on a limited number of setups. Also, in some cases, developers prepare indexes for new features in advance – " +
	"in such cases, dropping those indexes is not a good idea."
View Source
const MSG_REDUNDANT_INDEXES_FOUND_R3 string = "If there are some doubts, consider a more careful approach. Before actual" +
	"dropping, indexes disable listed in this report. For this, use queries like `UPDATE pg_index SET indisvalid = false " +
	"WHERE indexrelid::regclass = (select oid from pg_class where relname = 'u_users_email');. Indexes will " +
	"continue to get updates. In case of some performance degradations, re-enable the corresponding indexes, " +
	"setting indisvalid to true. If everything looks fine, after a significant period of observations, " +
	"proceed with DROP INDEX CONCURRENTLY."
View Source
const MSG_REDUNDANT_INDEXES_FOUND_UNDO string = "\"UNDO\" database migrations  \n%s"
View Source
const REDUNDANT_INDEXES_CRITICL_SIZE_PERCENT float64 = 5.0

Variables

This section is empty.

Functions

func H004PreprocessReportData

func H004PreprocessReportData(data map[string]interface{})

func H004Process

func H004Process(report H004Report) (checkup.ReportResult, error)

Types

type DatabaseStat

type DatabaseStat struct {
	StatsReset        string `json:"stats_reset"`
	StatsAge          string `json:"stats_age"`
	Days              int64  `json:"days"`
	DatabaseSizeBytes int64  `json:"database_size_bytes"`
}

type H004Index

type H004Index struct {
	Num                  int    `json:"num"`
	IndexId              string `json:"index_id"`
	SchemaName           string `json:"schema_name"`
	TableName            string `json:"table_name"`
	TableSizeBytes       int64  `json:"table_size_bytes"`
	IndexName            string `json:"index_name"`
	AccessMethod         string `json:"access_method"`
	Reason               string `json:"reason"`
	MainIndexDef         string `json:"main_index_def"`
	MainIndexSize        string `json:"main_index_size"`
	IndexDef             string `json:"index_def"`
	IndexSizeBytes       int64  `json:"index_size_bytes"`
	IndexUsage           int64  `json:"index_usage"`
	FormatedIndexName    string `json:"formated_index_name"`
	FormatedSchemaName   string `json:"formated_schema_name"`
	FormatedTableName    string `json:"formated_table_name"`
	FormatedRelationName string `json:"formated_relation_name"`
	SupportsFk           bool   `json:"supports_fk"`
}

type H004Indexes

type H004Indexes map[string]H004Index

type H004IndexesTotal

type H004IndexesTotal struct {
	IndexSizeBytesSum int64 `json:"index_size_bytes_sum"`
	TableSizeBytesSum int64 `json:"table_size_bytes_sum"`
}

type H004Report

type H004Report struct {
	Project       string                  `json:"project"`
	Name          string                  `json:"name"`
	CheckId       string                  `json:"checkId"`
	Timestamptz   string                  `json:"timestamptz"`
	Database      string                  `json:"database"`
	Dependencies  map[string]interface{}  `json:"dependencies"`
	LastNodesJson checkup.ReportLastNodes `json:"last_nodes_json"`
	Results       H004ReportHostsResults  `json:"results"`
}

type H004ReportHostResult

type H004ReportHostResult struct {
	Data      H004ReportHostResultData `json:"data"`
	NodesJson checkup.ReportLastNodes  `json:"nodes.json"`
}

type H004ReportHostResultData

type H004ReportHostResultData struct {
	RedundantIndexes      H004Indexes      `json:"redundant_indexes"`
	RedundantIndexesTotal H004IndexesTotal `json:"redundant_indexes_total"`
	Do                    []string         `json:"do"`
	UnDo                  []string         `json:"undo"`
	DatabaseStat          DatabaseStat     `json:"database_stat"`
	MinIndexSizeBytes     int64            `json:"min_index_size_bytes"`
}

type H004ReportHostsResults

type H004ReportHostsResults map[string]H004ReportHostResult

Jump to

Keyboard shortcuts

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