stats reset during pg_restore?

From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: stats reset during pg_restore?
Date: 2006-08-26 17:13:19
Message-ID: 8C5B026B51B6854CBE88121DBF097A863CD6CA@ehost010-33.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

This did not have any takers in pgsql-general. Maybe
performance-oriented folks can shed light? The basic question is if
there is a way to preserve stats during pg_restore?

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of George Pavlov
Sent: Monday, August 21, 2006 3:15 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] stats reset during pg_restore?

I would like to analyze server stats offline, so I attempt to pg_dump my
production database and then pg_restore it into another database. In the
process all stats seem to be reset (they are not completely zeroed). So
in production I have a table with the following stats (from
pg_stat_all_tables as an example):

relid | 25519576
relname | property_contact
seq_scan | 5612
seq_tup_read | 569971320
idx_scan | 4486454
idx_tup_fetch | 180100369
n_tup_ins | 39114
n_tup_upd | 17553
n_tup_del | 21877

After I restore the stats for the same table look like this:

relid | 104017313
relname | property_contact
seq_scan | 9
seq_tup_read | 992493
idx_scan | 0
idx_tup_fetch | 0
n_tup_ins | 110277
n_tup_upd | 0
n_tup_del | 0

These look like stats for table accesses during the restore itself:
11027 is indeed the number of rows in the table, and 992493 / 110277 =
9, which happens to be the number of indexes and FK constraints on the
table.

I do have stats_reset_on_server_start = off on both servers.

Can someone share what exatly happens with stats upon restore? Also is
there anything one can do to keep them intact during a dump/restore?

Apologies if already discussed--I failed to find any references.

TIA,

George

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Hayes 2006-08-26 20:11:54 [8.1.4] Help optimizing query
Previous Message Tom Lane 2006-08-25 17:55:20 Re: Changing max_connections without restart ?