X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 351659FC5B1 for ; Sun, 27 Aug 2006 11:38:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 75488-10 for ; Sun, 27 Aug 2006 14:38:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from lists.commandprompt.com (host-130.commandprompt.net [207.173.203.130]) by postgresql.org (Postfix) with ESMTP id 6506E9FC5AA for ; Sun, 27 Aug 2006 11:38:26 -0300 (ADT) Received: from alvh.no-ip.org (201-221-200-187.bk11-dsl.surnet.cl [201.221.200.187]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id k7REcJdk007061; Sun, 27 Aug 2006 07:38:24 -0700 Received: by alvh.no-ip.org (Postfix, from userid 1000) id CDDAFC2DC58; Sun, 27 Aug 2006 10:37:54 -0400 (CLT) Date: Sun, 27 Aug 2006 10:37:54 -0400 From: Alvaro Herrera To: George Pavlov Cc: pgsql-performance@postgresql.org Subject: Re: stats reset during pg_restore? Message-ID: <20060827143754.GA13665@alvh.no-ip.org> Mail-Followup-To: George Pavlov , pgsql-performance@postgresql.org References: <20060827024554.GD30132@alvh.no-ip.org> <8C5B026B51B6854CBE88121DBF097A863CD6DC@ehost010-33.exch010.intermedia.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8C5B026B51B6854CBE88121DBF097A863CD6DC@ehost010-33.exch010.intermedia.net> User-Agent: Mutt/1.5.12-2006-07-14 X-Virus-Scanned: ClamAV version 0.88.3, clamav-milter version 0.88.3 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Sun, 27 Aug 2006 07:38:24 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/415 X-Sequence-Number: 20600 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.