Re: lost statistics; analyze needs to execute twice

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: lost statistics; analyze needs to execute twice
Date: 2009-09-01 08:09:16
Message-ID: 9837222c0909010109m49aced7sf88622f070829476@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Sep 1, 2009 at 00:02, Jaime
Casanova<jcasanov(at)systemguards(dot)com(dot)ec> wrote:
> Hi,
>
> pgsql 8.3.7 and 8.4.0
>
> when i issue an "immediate shutdown" the statistics on all tables disappear...

That is by design. Whenever the server goes into crash recovery on
startup, it will clean out the statistics. Since the statistics data
is not kept crashsafe, there is no way to know if it's corrupt or not.

> and when i try to recover them via an analyze; (on all tables on the
> database) the result is nothing...
> i have to exexute the analyze commands twice to compute the statistics

pg_stat_* are not directly affected by ANALYZE. They collect runtime
statistics about activity in the tables, ANALYZE collects statistics
about what's *in* the tables (primarily stored in pg_statistics, not
pg_stat_*).

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2009-09-01 08:11:26 Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.
Previous Message Guillaume Smet 2009-09-01 06:54:02 Re: psql: FATAL: the database system is in recovery mode