Re: stats reset during pg_restore?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: George Pavlov <gpavlov(at)mynewplace(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: stats reset during pg_restore?
Date: 2006-08-27 14:37:54
Message-ID: 20060827143754.GA13665@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message George Pavlov 2006-08-27 16:40:49 Re: [8.1.4] Help optimizing query
Previous Message George Pavlov 2006-08-27 14:24:21 Re: stats reset during pg_restore?