Re: autovacuum "connections" are hidden - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: autovacuum "connections" are hidden
Date
Msg-id 20060518221103.GA3175@surnet.cl
Whole thread Raw
In response to Re: autovacuum "connections" are hidden  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: autovacuum "connections" are hidden  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > Tom Lane wrote:
> >>> Hmm, autovacuum won't show up in pg_stat_activity because it never
> >>> calls pgstat_report_activity().  Seems like maybe it should, though.
>
> > Yep.  I'll fix it.  Should I backpatch to 8.1?
>
> Yeah, probably, because this is really a regression from 8.0: the old
> contrib autovacuum's activities would show in pg_stat_activity, since
> it was just issuing the VACUUM/ANALYZE commands normally.

Hmm.  I had assumed this would be a quickie, but it turned out not to be
the case.  The problem is that while we can make autovac report quite
easily, other backends will ignore the backend entry because it hasn't
set a database ID.  (In pg_stat_get_backend_dbid, entries with NULL dbid
return NULL, so the pg_stat_activity view doesn't show them because it
uses a inner join.  Also, pgstat_report_autovac sets the database entry,
but it doesn't do anything about the backend entry.)

The problem is that pgstat_bestart (called in InitPostgres, which
autovac calls) deliberately ignores autovacuum, due to not having a
client address.  We could create a fake client address (which doesn't
seem easy to do), or we could change pg_stat_activity to use an OUTER
JOIN.  Not sure what other options are there.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: "Florian G. Pflug"
Date:
Subject: Re: GUI Interface
Next
From: Tom Lane
Date:
Subject: Re: autovacuum "connections" are hidden