Re: Manual vacs 5x faster than autovacs?

From: Dave Crooke <dcrooke(at)gmail(dot)com>
To: Wayne Beaver <wayne(at)acedsl(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Manual vacs 5x faster than autovacs?
Date: 2009-11-13 06:29:35
Message-ID: ca24673e0911122229v1ca274a2ya13f042de2fb8a63@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

The autovac may have done most of the work before you killed it ...
I'm new to Postgres, but from limited subjective experience, it seems
it's a lot faster to vaccum ranges of blocks that are were recently
vacuumed (at minimum, a good chunk of table will have been brought
into buffer cache by both Postgres and the OS during the prior pass).

I've found that with very large data tables, the auto-vaccum on
default settings isn't as aggressive as I'd like ... I find running a
VACUUM ANALYZE isn't at all intrusive, though I prefer to do it once a
day at 3am.

Beware that VACUUM FULL locks an entire table at a time :-)

Cheers
Dave

On Thu, Nov 12, 2009 at 8:33 AM, Wayne Beaver <wayne(at)acedsl(dot)com> wrote:
> Hi All,
>
> Running Pg 8.3RC2, Linux server, w/8GB RAM, OpenSuSE 10.2 OS (yes, I know
> that's old). I have seen *really* long-running autovacs eating up system
> resources. While the below is not an example of *really* long, it shows how
> I killed an autovac which had been running for more than 10 minutes, then
> ran a VAC FULL ANALYZE on same exact table in about ~2 min. Any wisdom here?
> Attributable to autovac_worker settings? Or Pg version? Other?
>
> Any insight appreciated.
>
> wb
>
> ++++++++++++++++++++++++++
>
> $ psql template1 -c "SELECT procpid, current_query, to_char (now() -
> backend_start, 'HH24:MI:SS') AS connected_et, to_char (now() -
> query_start,'HH24:MI:SS') AS query_et FROM pg_stat_activity WHERE
> datname='mydb' ORDER BY query_et DESC LIMIT 1"
>
>  procpid |                   current_query            | connected_et |
> query_et
> ---------+--------------------------------------------+--------------+----------
>    9064 | autovacuum: VACUUM ANALYZE myschema.mytable    | 00:12:07     |
> 00:11:38
>
>
>
> $ kill 9064
>
>
> $ date; psql mydb -c "VACUUM FULL ANALYZE myschema.mytable"; date
> Wed Nov 11 17:25:41 UTC 2009
> VACUUM
> Wed Nov 11 17:27:59 UTC 2009
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Laszlo Nagy 2009-11-13 12:46:15 SSD + RAID
Previous Message kirk Baillie 2009-11-12 18:11:44 Contract Web Architect Opportunity in Portland, Oregon