h002

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 H002_UNUSED_INDEXES_FOUND string = "H002_UNUSED_INDEXES_FOUND"
View Source
const H002_UNUSED_INDEXES_FOUND_DO string = "H002_UNUSED_INDEXES_FOUND_DO"
View Source
const H002_UNUSED_INDEXES_FOUND_P2 string = "H002_UNUSED_INDEXES_FOUND_P2"
View Source
const H002_UNUSED_INDEXES_FOUND_P3 string = "H002_UNUSED_INDEXES_FOUND_P3"
View Source
const H002_UNUSED_INDEXES_FOUND_UNDO string = "H002_UNUSED_INDEXES_FOUND_UNDO"
View Source
const MSG_UNUSED_INDEXES_FOUND_DO string = "\"DO\" database migrations  \n%s"
View Source
const MSG_UNUSED_INDEXES_FOUND_P2_CONCLUSION string = "[P2] %d unused index(es) have been found and their total size " +
	"exceeds %.2f%% of the database size."
View Source
const MSG_UNUSED_INDEXES_FOUND_P3_CONCLUSION string = "[P3] %d unused index(es) have been found."
View Source
const MSG_UNUSED_INDEXES_FOUND_R1 string = "Use the database migration provided below to drop the unused 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_UNUSED_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_UNUSED_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_UNUSED_INDEXES_FOUND_UNDO string = "\"UNDO\" database migrations  \n%s"
View Source
const UNUSED_INDEXES_CRITICL_SIZE_PERCENT float64 = 5.0

Variables

This section is empty.

Functions

func H002PreprocessReportData

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

func H002Process

func H002Process(report H002Report) (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 H002Index

type H002Index struct {
	Num                  int     `json:"num"`
	Reason               string  `json:"reason"`
	IndexId              string  `json:"index_id"`
	SchemaName           string  `json:"schema_name"`
	TableName            string  `json:"table_name"`
	IndexName            string  `json:"index_name"`
	IdxScan              int64   `json:"idx_scan"`
	AllScans             int64   `json:"all_scans"`
	IndexScanPct         float64 `json:"index_scan_pct"`
	Writes               int64   `json:"writes"`
	ScansPerWrite        float64 `json:"scans_per_write"`
	IndexSizeBytes       int64   `json:"index_size_bytes"`
	TableSizeBytes       int64   `json:"table_size_bytes"`
	Relpages             int64   `json:"relpages"`
	IdxIsBtree           bool    `json:"idx_is_btree"`
	IndexDef             string  `json:"index_def"`
	FormatedIndexName    string  `json:"formated_index_name"`
	FormatedSchemaName   string  `json:"formated_schema_name"`
	FormatedTableName    string  `json:"formated_table_name"`
	FormatedRelationName string  `json:"formated_relation_name"`
	Opclasses            string  `json:"opclasses"`
	SupportsFk           bool    `json:"supports_fk"`
	Grp                  int64   `json:"grp"`
}

type H002Indexes

type H002Indexes map[string]H002Index

type H002IndexesTotal

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

type H002Report

type H002Report 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       H002ReportHostsResults  `json:"results"`
}

type H002ReportHostResult

type H002ReportHostResult struct {
	Data      H002ReportHostResultData `json:"data"`
	NodesJson checkup.ReportLastNodes  `json:"nodes.json"`
}

type H002ReportHostResultData

type H002ReportHostResultData struct {
	NeverUsedIndexes       H002Indexes      `json:"never_used_indexes"`
	NeverUsedIndexesTotal  H002IndexesTotal `json:"never_used_indexes_total"`
	RarelyUsedIsndexes     H002Indexes      `json:"rarely_used_indexes"`
	RarelyUsedIndexesTotal H002IndexesTotal `json:"rarely_used_indexes_total"`
	Do                     []string         `json:"do"`
	UnDo                   []string         `json:"undo"`
	DatabaseStat           DatabaseStat     `json:"database_stat"`
	MinIndexSizeBytes      int64            `json:"min_index_size_bytes"`
}

type H002ReportHostsResults

type H002ReportHostsResults map[string]H002ReportHostResult

Jump to

Keyboard shortcuts

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