pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: George Pavlov <gpavlov@mynewplace.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: stats reset during pg_restore?
Date: Sun, 27 Aug 2006 10:37:54 -0400
Message-ID: <20060827143754.GA13665@alvh.no-ip.org> (raw)
In-Reply-To: <8C5B026B51B6854CBE88121DBF097A863CD6DC@ehost010-33.exch010.intermedia.net>
References: <20060827024554.GD30132@alvh.no-ip.org>
	<8C5B026B51B6854CBE88121DBF097A863CD6DC@ehost010-33.exch010.intermedia.net>

George Pavlov wrote:

> Based on how it works it seems that a server crash might lose the
> in-memory stats data as well?

Yeah, IIRC the postmaster removes the stat file after crash recovery.
It doesn't check the file for correctness.

> I imagine PITR does not take care of that special file (where is it
> by, by the way?). I have not worked with replication (yet), but I
> imagine replica databases will also be agnostic of the master's stats?

Neither PITR nor the replication systems I know about do anything about
the stats.

The file is $PGDATA/global/pgstat.stat

The code to read it, which is at the same time the documentation to its
format, is in src/backend/postmaster/pgstat.c, function
pgstat_read_statfile.  It's quite simple.  I think you could read it in
Perl if you wanted; and rewrite the file again after a restore (you'd
need to change the Oids in the table entries, etc).

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



view thread (4+ messages)

Message-ID: <20060827143754.GA13665@alvh.no-ip.org>
Permalink:  ../20060827143754.GA13665@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20060827143754.GA13665@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: alvherre@commandprompt.com, gpavlov@mynewplace.com
  Subject: Re: stats reset during pg_restore?
  In-Reply-To: <20060827143754.GA13665@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox