Unix Technical Forum

Re: Logging pg_autovacuum

This is a discussion on Re: Logging pg_autovacuum within the pgsql Hackers forums, part of the PostgreSQL category; --> Bruce Momjian wrote: > Matthew T. O'Connor wrote: >> I think there are two things people typically want to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 03:11 AM
Larry Rosenman
 
Posts: n/a
Default Re: Logging pg_autovacuum

Bruce Momjian wrote:
> Matthew T. O'Connor wrote:
>> I think there are two things people typically want to know from the
>> logs: 1) Is autovacuum running 2) Did autovacuum take action (issue
>> a VACUUM or ANALYZE)
>>
>> I don't think we need mention the name of each and every database we
>> touch, we can, but it should be at a lower level like DEBUG1 or
>> something.

>
> OK, that part is done.
>
>> I don't know what logging level these thing should go at, but I for
>> one would like them to be fairly high easy to get to, perhaps NOTICE?

>
> Interesting idea. I had forgotten that for server messages, LOG is at
> the top, and ERROR, NOTICE, etc are below it. We could make them
> NOTICE, but then all user NOTICE messages appear in the logs too.
> Yuck.
>
> Do we want to LOG everytime autovacuum does something? Is that going
> to fill up the logs worse than the per-database line?


My general take is I (as an admin), want to know that:
a) autovacuum is doing it's periodic checks
b) when it actually vacuums a (database|table) we know what time it did
it.


>
> The real issue is that we give users zero control over what autovacuum
> logs, leading to the TODO item. I guess the question is until the
> TODO item is done, what do we want to do?
>
> How do people like the idea of having this in postgresql.conf:
>
> autovacuum_set = 'set log_min_messages = ''error'''
>
> and set autovacuum to output notice/info/error messages as desired by
> the administrator? This shouldn't be too hard to do, and it is very
> flexible.


We definitely need to do "something" wrt autovacuum messages,
but this doesn't say what gets logged at what level for autovacuum.

I'd like to see a more concrete definition of what we
want Autovacuum to output and at what levels.

LER

--
Larry Rosenman
Database Support Engineer

PERVASIVE SOFTWARE. INC.
12365B RIATA TRACE PKWY
3015
AUSTIN TX 78727-6531

Tel: 512.231.6173
Fax: 512.231.6597
Email: Larry.Rosenman@pervasive.com
Web: www.pervasive.com

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 03:11 AM
Tom Lane
 
Posts: n/a
Default Re: Logging pg_autovacuum

"Larry Rosenman" <lrosenman@pervasive.com> writes:
> I'd like to see a more concrete definition of what we
> want Autovacuum to output and at what levels.


I would argue that what people typically want is

(0) nothing

(1) per-database log messages

or

(2) per-table log messages (including per-database)

The first problem is that (2) is only available at DEBUG2 or below,
which is not good because that also clutters the log with a whole lot of
implementer-level debugging info.

The second problem is that we don't really want to use the global
log_min_messages setting to determine this, because that constrains
your decision about how much chatter you want from ordinary backends.

I suggest that maybe the cleanest solution is to not use log level at
all for this, but to invent a separate "autovacuum_verbosity" setting
that controls how many messages autovac tries to log, using the above
scale. Anything it does try to log can just come out at LOG message
setting.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-12-2008, 03:11 AM
Chris Browne
 
Posts: n/a
Default Re: Logging pg_autovacuum

tgl@sss.pgh.pa.us (Tom Lane) writes:

> "Larry Rosenman" <lrosenman@pervasive.com> writes:
>> I'd like to see a more concrete definition of what we
>> want Autovacuum to output and at what levels.

>
> I would argue that what people typically want is
>
> (0) nothing
>
> (1) per-database log messages
>
> or
>
> (2) per-table log messages (including per-database)
>
> The first problem is that (2) is only available at DEBUG2 or below,
> which is not good because that also clutters the log with a whole
> lot of implementer-level debugging info.
>
> The second problem is that we don't really want to use the global
> log_min_messages setting to determine this, because that constrains
> your decision about how much chatter you want from ordinary
> backends.
>
> I suggest that maybe the cleanest solution is to not use log level
> at all for this, but to invent a separate "autovacuum_verbosity"
> setting that controls how many messages autovac tries to log, using
> the above scale. Anything it does try to log can just come out at
> LOG message setting.


At "level 2," it seems to me that it would be quite useful to have
some way of getting at the verbose output of VACUUM.

Consider when I vacuum a table, thus:

/* cbbrowne@[local]/dba2 performance=*/ vacuum verbose analyze days;
INFO: vacuuming "public.days"
INFO: "days": found 0 removable, 1893 nonremovable row versions in 9 pages
DETAIL: 0 dead row versions cannot be removed yet.
There were 0 unused item pointers.
0 pages are entirely empty.
CPU 0.00s/0.00u sec elapsed 0.03 sec.
INFO: analyzing "public.days"
INFO: "days": 9 pages, 1893 rows sampled, 1893 estimated total rows
VACUUM

The only thing that PostgreSQL will log generally about this is, if
the query runs for a while, that I requested "vacuum verbose analyze
days;", and that this took 4284ms to run.

It would be really nice if we could have some way of logging the
details, namely of numbers of row versions removed/nonremovable, and
of pages affected.

If we could regularly log that sort of information, that could be very
useful in figuring out some "more nearly optimal" schedule for
vacuuming.

One of our people wrote a Perl script that will take verbose VACUUM
output and essentially parses it so as to be able to generate a bunch
of SQL queries to try to collect how much time was spent, and what
sorts of changes got accomplished.

At present, getting anything out of that mandates that every VACUUM
request have stdout tied to this Perl script, which I'm not overly
keen on, for any number of reasons, notably:

- Any vacuums run separately aren't monitored at all

- Parsing not-forcibly-stable-across-versions file formats with Perl
is a fragile thing

- Ideally, this would be nice to get into the PG "engine," somewhere,
whether as part of standard logging, or as part of how pg_autovacuum
works...

Having some ability to collect statistics about "we recovered 42 pages
from table foo at 12:45" would seem useful both from an immediate
temporal perspective where it could suggest whether specific tables
were being vacuumed too (seldom|often), and from a more
global/analytic perspective of perhaps suggesting better kinds of
vacuuming policies. (In much the same way that I'd like to have some
way of moving towards an analytically better value for
default_statistics_target than 10...)

If people are interested, I could provide a copy of the "analyze
VACUUM stats" script...
--
(reverse (concatenate 'string "gro.mca" "@" "enworbbc"))
http://www.ntlug.org/~cbbrowne/sgml.html
"I would rather spend 10 hours reading someone else's source code than
10 minutes listening to Musak waiting for technical support which
isn't." -- Dr. Greg Wettstein, Roger Maris Cancer Center
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-12-2008, 03:11 AM
Tom Lane
 
Posts: n/a
Default Re: Logging pg_autovacuum

Chris Browne <cbbrowne@acm.org> writes:
> At "level 2," it seems to me that it would be quite useful to have
> some way of getting at the verbose output of VACUUM.


I think you can do that now, if you set min_log_level to INFO. However,
it might be cleaner if we allowed a "level 3" that made all of autovac's
vacuums be VERBOSE.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-12-2008, 03:11 AM
Larry Rosenman
 
Posts: n/a
Default Re: Logging pg_autovacuum

Tom Lane wrote:
> Chris Browne <cbbrowne@acm.org> writes:
>> At "level 2," it seems to me that it would be quite useful to have
>> some way of getting at the verbose output of VACUUM.

>
> I think you can do that now, if you set min_log_level to INFO.
> However, it might be cleaner if we allowed a "level 3" that made all
> of autovac's vacuums be VERBOSE.
>


I was thinking along those exact lines. (A 3rd level).

LER

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 512-248-2683 E-Mail: ler@lerctr.org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-12-2008, 03:11 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Logging pg_autovacuum

Larry Rosenman wrote:
> Tom Lane wrote:
> > Chris Browne <cbbrowne@acm.org> writes:
> >> At "level 2," it seems to me that it would be quite useful to have
> >> some way of getting at the verbose output of VACUUM.

> >
> > I think you can do that now, if you set min_log_level to INFO.
> > However, it might be cleaner if we allowed a "level 3" that made all
> > of autovac's vacuums be VERBOSE.

>
> I was thinking along those exact lines. (A 3rd level).


Also it'd be nice to have it a (4th?) level which would show the results
of the equations being applied.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-12-2008, 03:11 AM
Tom Lane
 
Posts: n/a
Default Re: Logging pg_autovacuum

Alvaro Herrera <alvherre@commandprompt.com> writes:
> Also it'd be nice to have it a (4th?) level which would show the results
> of the equations being applied.


That I think would fall more naturally into the category of debug
support --- I'm happy if we just emit that at DEBUG1 and let people
select it with log_min_messages.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-12-2008, 03:11 AM
Simon Riggs
 
Posts: n/a
Default Re: Logging pg_autovacuum

On Thu, 2006-04-27 at 14:53 -0400, Tom Lane wrote:
> "Larry Rosenman" <lrosenman@pervasive.com> writes:
> > I'd like to see a more concrete definition of what we
> > want Autovacuum to output and at what levels.

>
> autovacuum_verbosity


Should we call it autovacuum_messages?

In current usage...

_verbosity controls how much information each message gives
_messages controls what types of messages are logged

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com/


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-12-2008, 03:12 AM
Christopher Kings-Lynne
 
Posts: n/a
Default Re: Logging pg_autovacuum

> I suggest that maybe the cleanest solution is to not use log level at
> all for this, but to invent a separate "autovacuum_verbosity" setting
> that controls how many messages autovac tries to log, using the above
> scale. Anything it does try to log can just come out at LOG message
> setting.


+1


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-12-2008, 03:14 AM
Jim C. Nasby
 
Posts: n/a
Default Re: Logging pg_autovacuum

On Thu, Apr 27, 2006 at 08:12:23PM +0000, Chris Browne wrote:
> Having some ability to collect statistics about "we recovered 42 pages
> from table foo at 12:45" would seem useful both from an immediate
> temporal perspective where it could suggest whether specific tables
> were being vacuumed too (seldom|often), and from a more
> global/analytic perspective of perhaps suggesting better kinds of
> vacuuming policies. (In much the same way that I'd like to have some
> way of moving towards an analytically better value for
> default_statistics_target than 10...)
>
> If people are interested, I could provide a copy of the "analyze
> VACUUM stats" script...


Yeah, I'm interested. Though just like EXPLAIN output this seems like
another case where having the ability to log this information into the
database itself would be incredibly valuable for anyone wanting to do
later analysis.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:57 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com