1

I am benchmarking my database running in a Docker container against fragmentation issues and found out that the autovacuum daemon is not running.

SELECT
    schemaname, relname,
    last_vacuum, last_autovacuum,
    vacuum_count, autovacuum_count  -- not available on 9.0 and earlier
FROM pg_stat_user_tables;

gives:

| schemaname | relname     |last_vacuum| last_autovacuum |vacuum_count| autovacuum_count |
|------------|-------------|-----------|-----------------|------------| -----------------|
| public     | mt_doc_order|   <null>  |    <null>       |      0     |         0        |

I am therefore running into fragmentation performances effects:

enter image description here

How can I make sure that this autovacuum daemon is running when I am starting my PostgreSQL Docker Container?

Natalie Perret
  • 8,013
  • 12
  • 66
  • 129

1 Answers1

3

Run the SQL statement

ALTER SYSTEM SET autovacuum = on;

as superuser, then restart the PostgreSQL server process.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263