Thread: [tiny doc fix] statistics are not retained across immediate shutdown

[tiny doc fix] statistics are not retained across immediate shutdown

From
"Tsunakawa, Takayuki"
Date:
Hi,

In the following page, statistics are kept across server restarts:

http://www.postgresql.org/docs/current/static/monitoring-stats.html

"When the server shuts down, a permanent copy of the statistics data is stored in the global subdirectory, so that
statisticscan be retained across server restarts." 


However, statistics are not retained after immediate shutdown (pg_ctl stop -mi).  You may say "pg_ctl stop -mi is not a
shutdownbut an abort, so the sentence is not wrong", but it's an "immediate shutdown" and one mode of shutdown. 

I propose a tiny fix to clarify this.  Please find the attached patch.

I'd like this to be backported at least 9.2.  Thanks.


Regards, Takayuki Tsunakawa

Attachment

Re: [tiny doc fix] statistics are not retained across immediate shutdown

From
Tom Lane
Date:
"Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com> writes:
> I propose a tiny fix to clarify this.  Please find the attached patch.

That's not an accurate description of what happens, though.
AFAIR, we do not throw away pg_stats files as a result of recovery.
        regards, tom lane



Re: [tiny doc fix] statistics are not retained across immediate shutdown

From
Andres Freund
Date:
On 2013-09-04 10:53:19 -0400, Tom Lane wrote:
> "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com> writes:
> > I propose a tiny fix to clarify this.  Please find the attached patch.
> 
> That's not an accurate description of what happens, though.
> AFAIR, we do not throw away pg_stats files as a result of recovery.

StartupXLOG() does a pgstat_reset_all() in the if (InRecovery) branch.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



Re: [tiny doc fix] statistics are not retained across immediate shutdown

From
Fujii Masao
Date:
On Wed, Sep 4, 2013 at 11:56 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> On 2013-09-04 10:53:19 -0400, Tom Lane wrote:
>> "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com> writes:
>> > I propose a tiny fix to clarify this.  Please find the attached patch.
>>
>> That's not an accurate description of what happens, though.
>> AFAIR, we do not throw away pg_stats files as a result of recovery.
>
> StartupXLOG() does a pgstat_reset_all() in the if (InRecovery) branch.

Yes. And this causes one problem that the statistics data would be reset
at the start after the clean shutdown of the standby server.

Regards,

-- 
Fujii Masao



Re: [tiny doc fix] statistics are not retained across immediate shutdown

From
Bruce Momjian
Date:
Applied.

---------------------------------------------------------------------------

On Wed, Sep  4, 2013 at 04:11:09AM +0000, Tsunakawa, Takayuki wrote:
> Hi,
> 
> In the following page, statistics are kept across server restarts:
> 
> http://www.postgresql.org/docs/current/static/monitoring-stats.html
> 
> "When the server shuts down, a permanent copy of the statistics data is stored in the global subdirectory, so that
statisticscan be retained across server restarts."
 
> 
> 
> However, statistics are not retained after immediate shutdown (pg_ctl stop -mi).  You may say "pg_ctl stop -mi is not
ashutdown but an abort, so the sentence is not wrong", but it's an "immediate shutdown" and one mode of shutdown.
 
> 
> I propose a tiny fix to clarify this.  Please find the attached patch.
> 
> I'd like this to be backported at least 9.2.  Thanks.
> 
> 
> Regards, Takayuki Tsunakawa

> diff -rpcd a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
> *** a/doc/src/sgml/monitoring.sgml    2013-06-25 03:55:41.000000000 +0900
> --- b/doc/src/sgml/monitoring.sgml    2013-09-03 16:12:05.000000000 +0900
> *************** postgres: <replaceable>user</> <replacea
> *** 185,193 ****
>      <filename>pg_stat_tmp</filename> by default.
>      For better performance, <varname>stats_temp_directory</> can be
>      pointed at a RAM-based file system, decreasing physical I/O requirements.
> !    When the server shuts down, a permanent copy of the statistics
>      data is stored in the <filename>global</filename> subdirectory, so that
> !    statistics can be retained across server restarts.
>     </para>
>   
>    </sect2>
> --- 185,195 ----
>      <filename>pg_stat_tmp</filename> by default.
>      For better performance, <varname>stats_temp_directory</> can be
>      pointed at a RAM-based file system, decreasing physical I/O requirements.
> !    When the server shuts down cleanly, a permanent copy of the statistics
>      data is stored in the <filename>global</filename> subdirectory, so that
> !    statistics can be retained across server restarts.  When recovery is
> !    performed at server start (e.g. after immediate shutdown, server crash,
> !    and point-in-time recovery), all statistics counters are reset.
>     </para>
>   
>    </sect2>

> 
> -- 
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + Everyone has their own god. +