Re: too many clog files

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Duan Ligong <duanlg(at)nec-as(dot)nec(dot)com(dot)cn>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: too many clog files
Date: 2008-09-02 05:32:01
Message-ID: Pine.GSO.4.64.0809020117030.6014@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, 2 Sep 2008, Duan Ligong wrote:

> - Does Vacuum delete the old clog files?

Yes, if those transactions are all done. One possibility here is that
you've got some really long-running transaction floating around that is
keeping normal clog cleanup from happening. Take a look at the output
from "select * from pg_stat_activity" and see if there are any really old
transactions floating around.

> - Can we controll the maximum number of the clog files?

The reference Alvaro suggested at
http://www.postgresql.org/docs/8.3/interactive/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND
goes over that. If you reduce autovacuum_freeze_max_age, that reduces the
expected maximum size of the clog files. "The default, 200 million
transactions, translates to about 50MB of pg_clog storage." If you've got
significantly more than 50MB of files in there, normally that means that
either you're not running vacuum to clean things up usefully, or there's
an old open transaction still floating around.

> - When, or in what case is a new clog file produced?

Every 32K transactions. See http://wiki.postgresql.org/wiki/Hint_Bits for
some clarification about what the clog files actually do. I recently
collected some notes from this list and from the source code README files
to give a high-level view there of what actually goes on under the hood in
this area.

> - Is there a mechanism that the clog files are recycled? If there is ,
> what is the mechanism?

The old ones should get wiped out by vacuum's freezing mechanism.

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2008-09-02 05:47:01 Re: too many clog files
Previous Message Russell Smith 2008-09-02 03:54:53 Re: limit clause breaks query planner?