BUG #13750: Autovacuum slows down with large numbers of tables. More workers makes it slower.

From: daveg(at)sonic(dot)net
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13750: Autovacuum slows down with large numbers of tables. More workers makes it slower.
Date: 2015-10-30 13:32:52
Message-ID: 20151030133252.3033.4249@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13750
Logged by: David Gould
Email address: daveg(at)sonic(dot)net
PostgreSQL version: 9.4.5
Operating system: Linux
Description:

With more than a few tens of thousands of tables in one database
autovacuuming slows down radically and becomes ineffective. Increasing the
number of autovacuum workers makes the slow down worse.

A client has an application that loads data from thousands of external feeds
many times a day. They create a new table for each batch of new data. After
some months old tables are dropped. Typically the database has about 200,000
fairly small tables each of which has a few indexes and a toast. There are
also a lot of temp tables that come and go. pg_class has over 1/2 million
rows. The hosts have 80 hardware threads, 1TB of memory and fusionIO
storage.

They started seeing long running autovacuum workers doing antiwraparound
vacuums. pg_stat_activity showed workers had been vacuuming a single small
table (ex, 10k rows) for several hours, however in the query log the actual
vacuum took less than a second.

When they updated to 9.4.4 they also increased the number of autovacuum
workers in anticipation of the multixact fix causing extra vacuuming.
Several days later they observed massive catalog bloat, eg pg_attribute was
over 200GB of mostly empty pages. This caused new connections to get stuck
in startup as the catalogs no longer fit in the buffer cache.

I then tried experimenting with different setting of autovacuum workers and
found:

/Autovacuum Actions per Hour/
Workers Actions per Worker
1 2110.1 2110.1
2 1760.8 880.4
4 647.3 161.8
8 386.2 48.3
72 62.0 0.9

I have analyzed this and created reproduction scripts. I'll send that later
today.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2015-10-30 13:46:46 Re: BUG #13750: Autovacuum slows down with large numbers of tables. More workers makes it slower.
Previous Message digoal 2015-10-30 01:56:46 BUG #13749: PostgreSQL cann't compress random data?