Re: poor VACUUM performance on large tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jan(dot)l(dot)peterson(at)gmail(dot)com
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: poor VACUUM performance on large tables
Date: 2005-09-04 23:01:10
Message-ID: 9274.1125874870@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jan Peterson <jan(dot)l(dot)peterson(at)gmail(dot)com> writes:
> We have been experiencing poor performance of VACUUM in our production
> database.

Which PG version, exactly?

> Everything works great until our rolling delete kicks in. Of course,
> we are doing periodic VACUUMS on all tables, with frequent VACUUMs on
> the more active tables. The problem arises when we start deleting the
> bulk data and have to VACUUM pg_largeobject and our other larger
> tables. We have seen VACUUM run for several hours (even tens of
> hours).

Plain VACUUM (not FULL) certainly ought not take that long. (If you're
using VACUUM FULL, the answer is going to be "don't do that".) What
maintenance_work_mem (or vacuum_mem in older releases) are you running
it under? Can you get VACUUM VERBOSE output from some of these cases
so we can see which phase(s) are eating the time? It'd also be
interesting to watch the output of vmstat or local equivalent --- it
might just be that your I/O capability is nearly saturated and VACUUM is
pushing the system over the knee of the response curve. If so, the
vacuum delay options of 8.0 would be worth experimenting with.

> Statistics are also skewed during this
> process and we have observed the planner choosing sequential scans on
> tables where it is obvious that an index scan would be more efficient.

That's really pretty hard to believe; VACUUM doesn't affect the
statistics until the very end. Can you give some specifics of how
the "statistics are skewed"?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Martin Nickel 2005-09-05 02:56:01 Re: shared buffers
Previous Message Luke Lonergan 2005-09-04 17:19:53 Re: Poor performance on HP Package Cluster