Re: Something Weird Going on with VACUUM ANALYZE

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "sthomas(at)optionshouse(dot)com" <sthomas(at)optionshouse(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Something Weird Going on with VACUUM ANALYZE
Date: 2013-09-18 07:32:11
Message-ID: A737B7A37273E048B164557ADEF4A58B17C21CFC@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Shaun Thomas wrote:
> This is PostgreSQL 9.1.9.
>
> So we've had "vacuumdb -avz" launched via cron at 3am for a few years
> now, and recently noticed some queries behaving very badly. While
> checking pg_stat_user_tables, I see this for several hundred of them:
>
> relname | last_analyze
> ---------------------+----------------------------------
> some_table | 13-SEP-13 03:27:13.289291 -05:00
> another_table | 13-SEP-13 03:33:51.262007 -05:00
> yet_another_table | 13-SEP-13 03:23:27.630734 -05:00
>
> Yet last_vacuum shows this:
>
> relname | last_vacuum
> --------------------+----------------------------------
> some_table | 17-SEP-13 03:23:41.84311 -05:00
> another_table | 17-SEP-13 03:21:25.588267 -05:00
> yet_another_table | 17-SEP-13 03:21:28.944848 -05:00
>
> So I thought to myself, "Self, that's pretty freaking odd." The last
> vacuumdb (with analyze flag enabled) was this morning at 3am.
>
> Apparently something magical happened last Friday, and now analyze is
> broken somehow? Am I missing something, here? The log claims everything
> worked out OK:
>
> 2013-09-17 03:20:37 CDT|STATEMENT: VACUUM (VERBOSE, ANALYZE);
> 2013-09-17 03:37:31 CDT|LOG: duration: 2246467.567 ms statement:
> VACUUM (VERBOSE, ANALYZE);

It does sound odd.

What happens if you run VACUUM (VERBOSE, ANALYZE) manually?
Are the statistics updated?
Are there any warnings?

> These are from the same pid doing the vacuum. What's weird, is that the
> lines don't match up in time. The reported duration is 37 minutes, and
> since the vacuum launches at 3:00am, it matches with the last line. If
> that's the case, what on Earth is that line at 3:20 all about? The
> durations for the last few days have also been about 50% shorter than
> historically, which is mysterious all by itself.

No idea about this.
Is there a lot of load on the system?

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-09-18 07:41:40 Re: Cannot commit when autoCommit is enabled error
Previous Message David Johnston 2013-09-18 03:15:39 Re: Why does this array query fail?