vacuum on empty table takes very long

We have a partitioned table structure where the partitions are created
on a daily basis. One of the inserts into the daily partition failed
(crashed) ..the partition was empty after the crash. We did a vacuum
of the partition and it takes very long (over 30 minutes).

Postgres 8.1.2 ... vacuum_cost_delay = 0.

2 cpu...dual core with raid 10 6x300Gb disks.

the load during vacuum was normal (about 50% cpu util with a similar IO wait).

What is vacuum doing that takes so long on an empty table?

--
Sent via pgsql-admin mailing list (pgsql-admin [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Anj Adu [ Di, 18 August 2009 19:44 ] [ ID #2012517 ]

Re: vacuum on empty table takes very long

On Tue, Aug 18, 2009 at 11:44 AM, Anj Adu<fotographs [at] gmail.com> wrote:
> We have a partitioned table structure where the partitions are created
> on a daily basis. One of the inserts into the daily partition failed
> (crashed) ..the partition was empty after the crash. =A0We did a vacuum
> of the partition and it takes very long (over =A030 minutes).
>
> Postgres 8.1.2 =A0... vacuum_cost_delay =3D 0.

You need an update. You're missing years and years of bug fixes with
that version.

> What is vacuum doing that takes so long on an empty table?

Deleting tuples that aren't there. You're probably better off using trunca=
te:

begin;
trunctate only partition_table;
commit;

It's much faster. The begin / commit pair are just in case you do it
to the wrong table you can get your data back replacing commit with
rollback.

--
Sent via pgsql-admin mailing list (pgsql-admin [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Scott Marlowe [ Mi, 19 August 2009 18:32 ] [ ID #2012638 ]
Datenbanken » gmane.comp.db.postgresql.admin » vacuum on empty table takes very long

Vorheriges Thema: Please have a look at my PITR and verify script....
Nächstes Thema: Partial WAL file replay before fail-over startup