Re: lost statistics; analyze needs to execute twice - Mailing list pgsql-bugs

From Magnus Hagander
Subject Re: lost statistics; analyze needs to execute twice
Date
Msg-id 9837222c0909010109m49aced7sf88622f070829476@mail.gmail.com
Whole thread Raw
In response to lost statistics; analyze needs to execute twice  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Responses Re: lost statistics; analyze needs to execute twice  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Tue, Sep 1, 2009 at 00:02, Jaime
Casanova<jcasanov@systemguards.com.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/

pgsql-bugs by date:

Previous
From: Guillaume Smet
Date:
Subject: Re: psql: FATAL: the database system is in recovery mode
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.