Re: Megabytes of stats saved after every connection

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Phil Endecott <spam_from_postgresql_general(at)chezphil(dot)org>
Cc: pgsql-general(at)postgresql(dot)org, Jan Wieck <JanWieck(at)Yahoo(dot)com>
Subject: Re: Megabytes of stats saved after every connection
Date: 2005-07-28 18:03:12
Message-ID: 25623.1122573792@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Phil Endecott <spam_from_postgresql_general(at)chezphil(dot)org> writes:
> For some time I had been trying to work out why every connection to my
> database resulted in several megabytes of data being written to the
> disk, however trivial the query. I think I've found the culprit:
> global/pgstat.stat. This is with 7.4.7.

> This is for a web application which uses a new connection for each CGI
> request. The server doesn't have a particularly high disk bandwidth and
> this mysterious activity had been the bottleneck for some time. The
> system is a little unusual as one of the databases has tens of thousands
> of tables (though I saw these writes whichever database I connected to).

Well, there's the problem --- the stats subsystem is designed in a way
that makes it rewrite its entire stats collection on every update.
That's clearly not going to scale well to a large number of tables.
Offhand I don't see an easy solution ... Jan, any ideas?

> So can I expect this file to grow again? I think I need the stats,
> though I'm not entirely sure about that.

If you're not using autovacuum then you don't need stats_row_level.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jerry LeVan 2005-07-28 18:16:07 Korry Douglas's PostgreSQL 2ed out yet?
Previous Message Chris Guo 2005-07-28 17:54:41 Can't connect to posgresql server by using pgadmin