зеркало из https://github.com/mozilla/pontoon.git
Add an entry about VACUUM FULL to Maintenance docs (#3348)
This commit is contained in:
Родитель
ff2c4d0246
Коммит
d679904f5c
|
@ -54,3 +54,42 @@ and add them to the BLOCKED_IPs config variable in Heroku Settings.
|
|||
|
||||
.. _DDoS: https://en.wikipedia.org/wiki/Denial-of-service_attack
|
||||
.. _IP detection script: https://github.com/mozilla-l10n/pontoon-scripts/blob/main/dev/check_ips_heroku_log.py
|
||||
|
||||
Vacuuming a Database
|
||||
--------------------
|
||||
To reduce the size of Postgres DB tables and improve performance, it is recommended to
|
||||
`vacuum the database`_ regularly. Heroku already does that partially by running the
|
||||
`VACUUM` command automatically, but that only marks the space as available for reuse.
|
||||
|
||||
Running `VACUUM FULL` offers a more exhaustive cleanup and reduces bloat.
|
||||
|
||||
.. Warning::
|
||||
|
||||
`VACUUM FULL` is a heavyweight operation, which prevents any other statements from
|
||||
running concurrently, even simple SELECT queries. For most tables it only takes a
|
||||
few seconds to complete, but on the bigger tables it can take up to a few minutes.
|
||||
During that time, the application will be unresponsive.
|
||||
|
||||
You can run `VACUUM FULL` with the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ heroku pg:psql --app mozilla-pontoon
|
||||
=> VACUUM FULL table_name;
|
||||
|
||||
To list the DB tables, ordered by size, run:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ heroku pg:psql --app mozilla-pontoon
|
||||
=> SELECT
|
||||
table_name,
|
||||
pg_size_pretty(pg_total_relation_size(table_name::text)) AS size
|
||||
FROM
|
||||
information_schema.tables
|
||||
WHERE
|
||||
table_schema = 'public'
|
||||
ORDER BY
|
||||
pg_total_relation_size(table_name::text) DESC;
|
||||
|
||||
.. _vacuum the database: https://devcenter.heroku.com/articles/managing-vacuum-on-heroku-postgres
|
||||
|
|
Загрузка…
Ссылка в новой задаче