Thread: Slow VACUUM

Slow VACUUM

From
Wim
Date:
Hi guys,

I have a table that had 55 million records in it. I deleted about 15
million of them, because I had to free up disk space.
Yesterday, I started VACUUM. Now my problem is that it takes too long to
VACUUM the table: it is still running with my CPU in the red zone...

Is there a way to speed thing up?

PS I created 4 indexes on the tables. I cannot cancel the query... It
keeps running. Otherwise I thought of dropping the indexes, vacuum the
table and re-create the indexes...

Any advice from the gurus?


Cheers!
Wim De Hul
------------------------------------------------------------------------------
IP SERVICES SPECIALIST
Belgacom Carrier and Wholesale Business Unit (CBU)
------------------------------------------------------------------------------
AS6774
Ripe : WDH25-RIPE
reply-to : NOC{at}belbone{dot}be
peering : peering{at}belbone{dot}be
NOC Tel : +32 2/547.51.00
www.belgacom.be/carrier
------------------------------------------------------------------------------
When a program dies, what you need is a moment of serenity.
------------------------------------------------------------------------------
1:57pm up 3 days, 1:44, 1 user, load average: 1.27, 1.37, 1.42


Re: Slow VACUUM

From
Tom Lane
Date:
Wim <wdh@belbone.be> writes:
> PS I created 4 indexes on the tables. I cannot cancel the query... It
> keeps running. Otherwise I thought of dropping the indexes, vacuum the
> table and re-create the indexes...

Sure you can cancel it (assuming you're running any remotely up-to-date
version of Postgres).  If you didn't issue the vacuum command from an
interactive psql, the easiest way is to identify the backend running the
command and send it a SIGINT ("kill -INT pid-of-backend").  Be sure to
use SIGINT and not any other signal.

If what you're trying to do is a VACUUM FULL, dropping the indexes
should help.  Plain VACUUM I'm not so sure is worth the trouble.

Also you might try increasing VACUUM_MEM setting before you try again.

            regards, tom lane