pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_clog & vacuum oddness
10+ messages / 5 participants
[nested] [flat]
* pg_clog & vacuum oddness
@ 2003-10-29 16:03 Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 10+ messages in thread
From: Jeff @ 2003-10-29 16:03 UTC (permalink / raw)
To: pgsql-admin
I have a machine that typically runs good, but more and more recently
when vacuum runs everything (not just pg) comes to a griding halt. If
iostat is to be believed, there isn't too much IO going on - 300kB/sec
write, 0kB read.
Now before we diagnose this as "bah!" I noticed something odd - in my
pg_clog directory I have [currently] 384 files. there seem to be about
3-6/day in there. They all (except for hte last) have the same size of
200someodd-kB.
The DB is fairly active with around 20-100 (varies wildly)
insert/update/delete a second. I had vacuum & fsm tuned so my UnUsed
was rather steady.
The thing that bothers me most is why all that stuff in the clog?
There are entries in there that are older than the last time I spun PG.
Machine is a 2xp3-800mhz, 2gb, linux 2.2.17 [old], pg 7.3.4
--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
@ 2003-10-29 16:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:53 ` Re: pg_clog & vacuum oddness DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 16:54 ` Re: pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
0 siblings, 2 replies; 10+ messages in thread
From: Tom Lane @ 2003-10-29 16:32 UTC (permalink / raw)
To: Jeff <threshar@torgo.978.org>; +Cc: pgsql-admin
Jeff <threshar@torgo.978.org> writes:
> [ pg_clog not getting truncated ]
pg_clog is truncated on the basis of the oldest completely vacuumed
database in your installation. Most likely your maintenance script
is failing to vacuum some database(s) (template1, perhaps?) and/or
is doing table-by-table vacuums rather than an unqualified VACUUM.
I doubt this explains any performance problems though. Old pg_clog
segments don't do anything except sit there.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-10-29 16:53 ` DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 17:01 ` Re: pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 17:24 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 2 replies; 10+ messages in thread
From: DHS Webmaster @ 2003-10-29 16:53 UTC (permalink / raw)
To: pgsql-admin
This thread caught my eye and I decided to look at our pg_clog
directory. Sure enough we have got every clog file since we upgraded
back in April, 0000 - 02F8.
We vacuum our working database nightly. Although this is not a 'full',
we don't exclude any tables. We don't do anything with template1
(knowingly), so we do not perform any maintenance on it either.
Questions:
1. Should we be doing a periodic vacuum on template1?
2. Is what I am seeing possibly indicative of something else beside
template1 that would show up the postgres log.
3. It is safe to delete all the clog files prior to the last restart of
postgres, yes?
Tom Lane wrote:
>
> Jeff <threshar@torgo.978.org> writes:
> > [ pg_clog not getting truncated ]
>
> pg_clog is truncated on the basis of the oldest completely vacuumed
> database in your installation. Most likely your maintenance script
> is failing to vacuum some database(s) (template1, perhaps?) and/or
> is doing table-by-table vacuums rather than an unqualified VACUUM.
>
> I doubt this explains any performance problems though. Old pg_clog
> segments don't do anything except sit there.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
--
Bill MacArthur
Webmaster
DHS Club
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:53 ` Re: pg_clog & vacuum oddness DHS Webmaster <webmaster@dhs-club.com>
@ 2003-10-29 17:01 ` Jeff <threshar@torgo.978.org>
2003-10-29 17:17 ` Re: pg_clog & vacuum oddness DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 17:23 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 17:57 ` Re: pg_clog & vacuum oddness Christopher Browne <cbbrowne@libertyrms.info>
1 sibling, 3 replies; 10+ messages in thread
From: Jeff @ 2003-10-29 17:01 UTC (permalink / raw)
To: DHS Webmaster <webmaster@dhs-club.com>; +Cc: pgsql-admin
On Wed, 29 Oct 2003 11:53:38 -0500
DHS Webmaster <webmaster@dhs-club.com> wrote:
> We vacuum our working database nightly. Although this is not a 'full',
> we don't exclude any tables. We don't do anything with template1
> (knowingly), so we do not perform any maintenance on it either.
Why not go through the list in pg_database to make sure you didn't
forget about any (like I did).
given that template0 and 1 rarely change.. I don't see why we'd need to
vacuum them
--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:53 ` Re: pg_clog & vacuum oddness DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 17:01 ` Re: pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
@ 2003-10-29 17:17 ` DHS Webmaster <webmaster@dhs-club.com>
2 siblings, 0 replies; 10+ messages in thread
From: DHS Webmaster @ 2003-10-29 17:17 UTC (permalink / raw)
To: Jeff <threshar@torgo.978.org>; +Cc: pgsql-admin
Well, you know, I looked at the list and saw only template0, template1 &
our working DB. So just for kicks I vacuumed template1. That cleared the
directory. To my knowledge we did not modify template1 one when we setup
the database initially, so perhaps it just needed a vacuum to set the
stage correctly. Either that or during our data import, there was
something in the import file that referenced template1 which created a
need for vacuuming.
Whatever the case, this was an interesting exercise which I'm sure will
prove useful in the future.
Thank you.
--
Bill MacArthur
Webmaster
DHS Club
Jeff wrote:
>
> On Wed, 29 Oct 2003 11:53:38 -0500
> DHS Webmaster <webmaster@dhs-club.com> wrote:
>
> > We vacuum our working database nightly. Although this is not a 'full',
> > we don't exclude any tables. We don't do anything with template1
> > (knowingly), so we do not perform any maintenance on it either.
>
> Why not go through the list in pg_database to make sure you didn't
> forget about any (like I did).
>
> given that template0 and 1 rarely change.. I don't see why we'd need to
> vacuum them
>
> --
> Jeff Trout <jeff@jefftrout.com>
> http://www.jefftrout.com/
> http://www.stuarthamm.net/
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:53 ` Re: pg_clog & vacuum oddness DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 17:01 ` Re: pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
@ 2003-10-29 17:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-10-30 00:13 ` Re: pg_clog & vacuum oddness Gaetano Mendola <mendola@bigfoot.com>
2 siblings, 1 reply; 10+ messages in thread
From: Tom Lane @ 2003-10-29 17:23 UTC (permalink / raw)
To: Jeff <threshar@torgo.978.org>; +Cc: DHS Webmaster <webmaster@dhs-club.com>; pgsql-admin
Jeff <threshar@torgo.978.org> writes:
> given that template0 and 1 rarely change.. I don't see why we'd need to
> vacuum them
You have to vacuum template1 periodically if you want pg_clog to shrink.
You may know that you've never changed it, but the VACUUM code doesn't
know that.
template0 need not get vacuumed as long as it's marked datallowconn = false
in pg_database. VACUUM assumes it's not been changed if that flag is
present.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:53 ` Re: pg_clog & vacuum oddness DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 17:01 ` Re: pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 17:23 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-10-30 00:13 ` Gaetano Mendola <mendola@bigfoot.com>
0 siblings, 0 replies; 10+ messages in thread
From: Gaetano Mendola @ 2003-10-30 00:13 UTC (permalink / raw)
To: pgsql-admin; +Cc: Tom Lane <tgl@sss.pgh.pa.us>
Tom Lane wrote:
> Jeff <threshar@torgo.978.org> writes:
>
>>given that template0 and 1 rarely change.. I don't see why we'd need to
>>vacuum them
> You have to vacuum template1 periodically if you want pg_clog to shrink.
WOW, I saved 200 MB in one shoot vacuuming template 1 !
I learned this after 2 years of postgres, I'm a dummy.
Regards
Gaetano Mendola
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:53 ` Re: pg_clog & vacuum oddness DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 17:01 ` Re: pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
@ 2003-10-29 17:57 ` Christopher Browne <cbbrowne@libertyrms.info>
2 siblings, 0 replies; 10+ messages in thread
From: Christopher Browne @ 2003-10-29 17:57 UTC (permalink / raw)
To: pgsql-admin
threshar@torgo.978.org (Jeff) writes:
> On Wed, 29 Oct 2003 11:53:38 -0500
> DHS Webmaster <webmaster@dhs-club.com> wrote:
>
>> We vacuum our working database nightly. Although this is not a 'full',
>> we don't exclude any tables. We don't do anything with template1
>> (knowingly), so we do not perform any maintenance on it either.
>
> Why not go through the list in pg_database to make sure you didn't
> forget about any (like I did).
>
> given that template0 and 1 rarely change.. I don't see why we'd need to
> vacuum them
template0 is probably set to 'not changeable' so that you can't even
log in to it.
template1 probably isn't hit a _lot_, but surely not "not at all." It
is accessed at such times as:
- When you run "createdb", data probably gets used from there to
populate the new DB.
- When you update user IDs, that's shared information likely to
"touch" template1.
You don't need to vacuum it often, but "seldom" is not quite the same
as "never."
--
output = ("cbbrowne" "@" "libertyrms.info")
<http://dev6.int.libertyrms.com/;
Christopher Browne
(416) 646 3304 x124 (land)
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:53 ` Re: pg_clog & vacuum oddness DHS Webmaster <webmaster@dhs-club.com>
@ 2003-10-29 17:24 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 10+ messages in thread
From: Tom Lane @ 2003-10-29 17:24 UTC (permalink / raw)
To: DHS Webmaster <webmaster@dhs-club.com>; +Cc: pgsql-admin
DHS Webmaster <webmaster@dhs-club.com> writes:
> 1. Should we be doing a periodic vacuum on template1?
Yes.
> 3. It is safe to delete all the clog files prior to the last restart of
> postgres, yes?
NO. That WILL destroy your database. Much safer to let VACUUM do
it for you.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: pg_clog & vacuum oddness
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Re: pg_clog & vacuum oddness Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-10-29 16:54 ` Jeff <threshar@torgo.978.org>
1 sibling, 0 replies; 10+ messages in thread
From: Jeff @ 2003-10-29 16:54 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
On Wed, 29 Oct 2003 11:32:12 -0500
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Jeff <threshar@torgo.978.org> writes:
> > [ pg_clog not getting truncated ]
>
> pg_clog is truncated on the basis of the oldest completely vacuumed
> database in your installation. Most likely your maintenance script
> is failing to vacuum some database(s) (template1, perhaps?) and/or
> is doing table-by-table vacuums rather than an unqualified VACUUM.
>
> I doubt this explains any performance problems though. Old pg_clog
> segments don't do anything except sit there.
>
> regards, tom lane
>
thanks, that did it - I hadn't been vacuuming a rarely used db we have
tossed on there too.
--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2003-10-30 00:13 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-29 16:03 pg_clog & vacuum oddness Jeff <threshar@torgo.978.org>
2003-10-29 16:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:53 ` DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 17:01 ` Jeff <threshar@torgo.978.org>
2003-10-29 17:17 ` DHS Webmaster <webmaster@dhs-club.com>
2003-10-29 17:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-10-30 00:13 ` Gaetano Mendola <mendola@bigfoot.com>
2003-10-29 17:57 ` Christopher Browne <cbbrowne@libertyrms.info>
2003-10-29 17:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-10-29 16:54 ` Jeff <threshar@torgo.978.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox