|
1 | 1 | package f005 |
2 | 2 |
|
3 | | -const MSG_NO_RECOMMENDATIONS string = "All good, no recommendations here." |
4 | | -const MSG_TOTAL_BLOAT_EXCESS_CONCLUSION string = "[P1] Total index bloat estimation is %s, it is %.2f%% of overall indexes size and %.2f%% of the DB size. " + |
5 | | - "So removing the index bloat can help to reduce the total database size to ~%s and to increase the free disk space by %s. " + |
6 | | - "Notice that this is only an estimation, sometimes it may be significantly off. Total size of indexes is %.2f times bigger than it could be. \n" |
| 3 | +const MSG_NO_RECOMMENDATIONS string = "All good 👍" |
7 | 4 |
|
8 | | -const MSG_TOTAL_BLOAT_LOW_CONCLUSION string = "The total index bloat estimate is quite low, just ~%.2f%% (~%s). Hooray! Keep watching it though." |
9 | | -const MSG_BLOAT_CRITICAL_RECOMMENDATION string = "[P1] Reduce and prevent high level of index bloat: \n" + |
10 | | - " - tune autovacuum: consider more aggressive autovacuum settings (See F001) \n" + |
11 | | - " - reduce index bloat using one of the approaches mentioned below. \n" |
12 | | -const MSG_BLOAT_WARNING_RECOMMENDATION string = "[P2] Reduce and prevent high level of index bloat: \n" + |
13 | | - " - tune autovacuum: consider more aggressive autovacuum settings (See F001) \n" + |
14 | | - " - reduce index bloat using one of the approaches mentioned below. \n" |
| 5 | +const MSG_TOTAL_BLOAT_EXCESS_CONCLUSION string = "[P1] Total index (btree only) bloat estimation is ~%s, it is %.2f%% of the overall size of all indexes and %.2f%% of the DB size. " + |
| 6 | + "Removing the index bloat will reduce the total DB size down to ~%s. Free disk space will be increased by ~%s. " + |
| 7 | + "Total size of indexes is %.2f times bigger than it could be. " + |
| 8 | + "Notice that this is only an estimation, sometimes it may be significantly off.\n" |
| 9 | + |
| 10 | +const MSG_TOTAL_BLOAT_LOW_CONCLUSION string = "The estimated index (btree only) bloat in this DB is low, just ~%.2f%% (~%s). No action is needed now. Keep watching it though.\n" |
| 11 | +const MSG_BLOAT_CRITICAL_RECOMMENDATION string = "[P1] Reduce and prevent a high level of index bloat:\n" + |
| 12 | + " - to prevent a high level of bloat in the future, tune autovacuum: consider more aggressive autovacuum settings (see F001);\n" + |
| 13 | + " - eliminate or reduce the current index bloat using one of the approaches listed below.\n" |
| 14 | +const MSG_BLOAT_WARNING_RECOMMENDATION string = "[P2] Consider the following:\n" + |
| 15 | + " - to prevent a high level of bloat in the future, tune autovacuum: consider more aggressive autovacuum settings (see F001);\n" + |
| 16 | + " - eliminate or reduce the current index bloat using one of the approaches listed below.\n" |
15 | 17 | const MSG_BLOAT_GENERAL_RECOMMENDATION_1 string = "If you want to get exact bloat numbers, clone the database, get index sizes, then apply " + |
16 | | - "`VACUUM FULL` and get new index sizes. This will give the most reliable numbers. \n" |
17 | | -const MSG_BLOAT_GENERAL_RECOMMENDATION_2 string = "To reduce the index bloat, consider using one of the following: \n" + |
18 | | - " - [`VACUUM FULL`](https://www.postgresql.org/docs/current/sql-vacuum.html) (:warning: requires downtime / maintenance window), \n" + |
19 | | - " - [`REINDEX`](https://www.postgresql.org/docs/current/sql-reindex.html) (`REINDEX INDEX`, `REINDEX TABLE`; :warning: requires downtime / maintenance window), \n" + |
20 | | - " - recreating indexes online using `CREATE INDEX CONCURRENTLY`, `DROP INDEX CONCURRENTLY` and renaming (not trivial for indexes supporting PK, FK) // Postgres 12 also provides `REINDEX CONCURRENTLY`, \n" + |
| 18 | + "database-wide `VACUUM FULL` (it eliminates all the bloat), and gets new table sizes. Then compare old and new numbers.\n" |
| 19 | +const MSG_BLOAT_GENERAL_RECOMMENDATION_2 string = "To reduce the index bloat, consider one of the following approaches:\n" + |
| 20 | + " - [`VACUUM FULL`](https://www.postgresql.org/docs/current/sql-vacuum.html) (:warning: requires downtime / maintenance window),\n" + |
| 21 | + " - [`REINDEX`](https://www.postgresql.org/docs/current/sql-reindex.html) (`REINDEX INDEX`, `REINDEX TABLE`; :warning: requires downtime / maintenance window),\n" + |
| 22 | + " - recreating indexes online using `CREATE INDEX CONCURRENTLY`, `DROP INDEX CONCURRENTLY` and renaming (not trivial for indexes supporting PK, FK) // `REINDEX CONCURRENTLY` is available in Postgres 12+,\n" + |
21 | 23 | " - one of the tools reducing the bloat online, without interrupting the operations: \n" + |
22 | | - " - [pg_repack](https://github.com/reorg/pg_repack), \n" + |
23 | | - " - [pg_squeeze](https://github.com/reorg/pg_repack), \n" + |
24 | | - " - [pgcompacttable](https://github.com/dataegret/pgcompacttable). \n" |
25 | | -const MSG_BLOAT_PX_RECOMMENDATION string = "Read more on this topic: \n" + |
26 | | - " - [Index maintenance](https://wiki.postgresql.org/wiki/Index_Maintenance) (PostgreSQL wiki) \n" + |
27 | | - " - [Btree bloat query](http://blog.ioguix.net/postgresql/2014/11/03/Btree-bloat-query-part-4.html) (2014, ioguix) \n" + |
28 | | - " - [PostgreSQL Index bloat under a microscope](http://pgeoghegan.blogspot.com/2017/07/postgresql-index-bloat-microscope.html) (2017, Peter Geoghegan) \n" + |
| 24 | + " - [pg_repack](https://github.com/reorg/pg_repack),\n" + |
| 25 | + " - [pg_squeeze](https://github.com/reorg/pg_repack),\n" + |
| 26 | + " - [pgcompacttable](https://github.com/dataegret/pgcompacttable).\n" |
| 27 | +const MSG_BLOAT_PX_RECOMMENDATION string = "Read more on this topic:\n" + |
| 28 | + " - [Index maintenance](https://wiki.postgresql.org/wiki/Index_Maintenance) (PostgreSQL wiki)\n" + |
| 29 | + " - [Btree bloat query](http://blog.ioguix.net/postgresql/2014/11/03/Btree-bloat-query-part-4.html) (2014, ioguix)\n" + |
| 30 | + " - [PostgreSQL Index bloat under a microscope](http://pgeoghegan.blogspot.com/2017/07/postgresql-index-bloat-microscope.html) (2017, Peter Geoghegan)\n" + |
29 | 31 | " - [PostgreSQL Bloat: origins, monitoring and managing](https://www.compose.com/articles/postgresql-bloat-origins-monitoring-and-managing/) (2016, Compose) \n" + |
30 | | - " - [Dealing with significant Postgres database bloat — what are your options?](Dealing with significant Postgres database bloat — what are your options?) (2018, Compass) \n" + |
31 | | - " - [Postgres database bloat analysis](https://about.gitlab.com/handbook/engineering/infrastructure/blueprint/201901-postgres-bloat/) (2019, GitLab) \n" |
| 32 | + " - [Dealing with significant Postgres database bloat — what are your options?](Dealing with significant Postgres database bloat — what are your options?) (2018, Compass)\n" + |
| 33 | + " - [Postgres database bloat analysis](https://about.gitlab.com/handbook/engineering/infrastructure/blueprint/201901-postgres-bloat/) (2019, GitLab)\n" |
32 | 34 | const MSG_BLOAT_WARNING_CONCLUSION_1 string = "[P2] There is %d index with size > 1 MiB and index bloat estimate >= %.0f%% and < %.0f%%: \n%s \n" |
33 | 35 | const MSG_BLOAT_CRITICAL_CONCLUSION_1 string = "[P1] The following %d index has significant size (>1 MiB) and bloat estimate > %.0f%%: \n%s \n" |
34 | 36 | const MSG_BLOAT_WARNING_CONCLUSION_N string = "[P2] There are %d indexes with size > 1 MiB and index bloat estimate >= %.0f%% and < %.0f%%: \n%s \n" |
35 | 37 | const MSG_BLOAT_CRITICAL_CONCLUSION_N string = "[P1] The following %d indexes have significant size (>1 MiB) and bloat estimate > %.0f%%: \n%s \n" |
36 | 38 |
|
37 | | -const INDEX_DETAILS string = " - `%s`: size %s, can be reduced %.2f times, by ~%s (~%.0f%%) \n" |
| 39 | +const INDEX_DETAILS string = " - `%s`: size %s, can be reduced %.2f times, by ~%s (~%.0f%%)\n" |
0 commit comments