Documentation ¶
Index ¶
- Constants
- func F004GetBloatedTables(report F004Report) []string
- func F004PreprocessReportData(data map[string]interface{})
- func F004Process(report F004Report) checkup.ReportResult
- type F004HeapBloat
- type F004HeapBloatTotal
- type F004Report
- type F004ReportHostResult
- type F004ReportHostResultData
- type F004ReportHostsResults
Constants ¶
View Source
const CRITICAL_BLOAT_RATIO float32 = 90.0
View Source
const CRITICAL_TOTAL_BLOAT_RATIO float32 = 20.0
View Source
const F004_BLOATED_TABLES string = "F004_BLOATED_TABLES"
View Source
const F004_BLOAT_CRITICAL string = "F004_BLOAT_CRITICAL"
View Source
const F004_BLOAT_INFO string = "F004_BLOAT_INFO"
View Source
const F004_BLOAT_WARNING string = "F004_BLOAT_WARNING"
View Source
const F004_GENERAL_INFO string = "F004_GENERAL_INFO"
View Source
const F004_TOTAL_BLOAT_EXCESS string = "F004_TOTAL_BLOAT_EXCESS"
View Source
const F004_TOTAL_BLOAT_LOW string = "F004_TOTAL_BLOAT_LOW"
View Source
const MIN_TABLE_SIZE_TO_ANALYZE int64 = 1024 * 1024
View Source
const MSG_BLOAT_CRITICAL_CONCLUSION_1 string = "[P1] The following %d table has significant size (>1 MiB) and bloat estimate > %.2f%%: \n%s \n"
View Source
const MSG_BLOAT_CRITICAL_CONCLUSION_N string = "[P1] The following %d tables have significant size (>1 MiB) and bloat estimate > %.2f%%: \n%s \n"
View Source
const MSG_BLOAT_CRITICAL_RECOMMENDATION string = "[P1] Reduce and prevent the high level of table bloat:\n" +
" - to prevent a high level of bloat in the future, tune autovacuum: consider more aggressive autovacuum settings (see F001);\n" +
" - eliminate or reduce the current table bloat using one of the approaches listed below.\n"
View Source
const MSG_BLOAT_GENERAL_RECOMMENDATION_1 string = "If you want to get exact bloat numbers, clone the database, get table sizes, then apply " +
"database-wide `VACUUM FULL` (it eliminate all the bloat), and get new table sizes. Then compare old and new numbers.\n"
View Source
const MSG_BLOAT_GENERAL_RECOMMENDATION_2 string = "To reduce the table bloat, consider one of the following approaches:\n" +
" - [`VACUUM FULL`](https://www.postgresql.org/docs/current/sql-vacuum.html) (:warning: requires downtime / maintenance window),\n" +
" - one of the tools reducing the bloat online, without interrupting the operations:\n" +
" - [pg_repack](https://github.com/reorg/pg_repack),\n" +
" - [pg_squeeze](https://github.com/cybertec-postgresql/pg_squeeze),\n" +
" - [pgcompacttable](https://github.com/dataegret/pgcompacttable).\n"
View Source
const MSG_BLOAT_PX_RECOMMENDATION string = "Read more on this topic:\n" +
" - [Bloat estimation for tables](http://blog.ioguix.net/postgresql/2014/09/10/Bloat-estimation-for-tables.html) (2014, ioguix)\n" +
" - [Show database bloat](https://wiki.postgresql.org/wiki/Show_database_bloat) (PostgreSQL wiki)\n" +
" - [PostgreSQL Bloat: origins, monitoring and managing](https://www.compose.com/articles/postgresql-bloat-origins-monitoring-and-managing/) (2016, Compose)\n" +
" - [Dealing with significant Postgres database bloat — what are your options?](https://medium.com/compass-true-north/dealing-with-significant-postgres-database-bloat-what-are-your-options-a6c1814a03a5) (2018, Compass)\n" +
" - [Postgres database bloat analysis](https://about.gitlab.com/handbook/engineering/infrastructure/blueprint/201901-postgres-bloat/) (2019, GitLab)\n"
View Source
const MSG_BLOAT_WARNING_CONCLUSION_1 string = "[P2] There is %d table with size > 1 MiB and table bloat estimate >= %.2f%% and < %.2f%%: \n%s\n"
View Source
const MSG_BLOAT_WARNING_CONCLUSION_N string = "[P2] There are %d tables with size > 1 MiB and table bloat estimate >= %.2f%% and < %.2f%%: \n%s \n"
View Source
const MSG_BLOAT_WARNING_RECOMMENDATION string = "[P2] Consider the following:\n" +
" - to prevent a high level of bloat in the future, tune autovacuum: consider more aggressive autovacuum settings (see F001);\n" +
" - eliminate or reduce the current table bloat using one of the approaches listed below.\n"
View Source
const MSG_BLOAT_WARNING_RECOMMENDATION_TABLES string = "" /* 182-byte string literal not displayed */
View Source
const MSG_NO_RECOMMENDATIONS string = "All good 👍\n"
View Source
const MSG_TOTAL_BLOAT_EXCESS_CONCLUSION string = "[P1] Total table (heap) bloat estimation is ~%s, it is %.2f%% of the overall size of all tables and %.2f%% of the DB size. " +
"Removing the table bloat will reduce the total DB size down to ~%s. Free disk space will be increased by ~%s. " +
"Total size of tables is %.2f times bigger than it could be. " +
"Notice that this is only an estimation, sometimes it may be significantly off.\n"
View Source
const MSG_TOTAL_BLOAT_LOW_CONCLUSION string = "The estimated table (heap) bloat in this DB is low, just ~%.2f%% (~%s). No action is needed now. Keep watching it though.\n"
View Source
const TABLE_DETAILS string = " - `%s`: size %s, can be reduced %.2f times, by ~%s (~%.2f%%) \n"
View Source
const WARNING_BLOAT_RATIO float32 = 40.0
Variables ¶
This section is empty.
Functions ¶
func F004GetBloatedTables ¶
func F004GetBloatedTables(report F004Report) []string
func F004PreprocessReportData ¶
func F004PreprocessReportData(data map[string]interface{})
func F004Process ¶
func F004Process(report F004Report) checkup.ReportResult
Generate conclusions and recommendatons
Types ¶
type F004HeapBloat ¶
type F004HeapBloat struct { Num int `json:"num"` IsNa string `json:"is_na"` TableName string `json:"table_name"` ExtraSizeBytes int64 `json:"extra_size_bytes"` ExtraRatioPercent float32 `json:"extra_ratio_percent"` BloatSizeBytes int64 `json:"bloat_size_bytes"` BloatRatioPercent float32 `json:"bloat_ratio_percent"` RealSizeBytes int64 `json:"real_size_bytes"` LiveDataSizeBytes int64 `json:"live_data_size_bytes"` LastVaccuum string `json:"last_vaccuum"` Fillfactor float32 `json:"fillfactor"` OverriddenSettings bool `json:"overridden_settings"` BloatRatioFactor float32 `json:"bloat_ratio_factor"` }
type F004HeapBloatTotal ¶
type F004HeapBloatTotal struct { Count int `json:"count"` ExtraSizeBytesSum int64 `json:"extra_size_bytes_sum"` RealSizeBytesSum int64 `json:"real_size_bytes_sum"` BloatSizeBytesSum int64 `json:"bloat_size_bytes_sum"` LiveDataSizeBytesSum int64 `json:"live_data_size_bytes_sum"` BloatRatioPercentAvg float32 `json:"bloat_ratio_percent_avg"` BloatRatioFactorAvg float32 `json:"bloat_ratio_factor_avg"` }
Current database tables list
type F004Report ¶
type F004Report 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 F004ReportHostsResults `json:"results"` }
func F004LoadReportData ¶
func F004LoadReportData(filePath string) (F004Report, error)
type F004ReportHostResult ¶
type F004ReportHostResult struct { Data F004ReportHostResultData `json:"data"` NodesJson checkup.ReportLastNodes `json:"nodes.json"` }
type F004ReportHostResultData ¶
type F004ReportHostResultData struct { HeapBloat map[string]F004HeapBloat `json:"heap_bloat"` HeapBloatTotal F004HeapBloatTotal `json:"heap_bloat_total"` OverriddenSettingsCount int `json:"overridden_settings_count"` DatabaseSizeBytes int64 `json:"database_size_bytes"` }
type F004ReportHostsResults ¶
type F004ReportHostsResults map[string]F004ReportHostResult
Click to show internal directories.
Click to hide internal directories.