Re: statement_timeout logging

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: statement_timeout logging
Date: 2005-09-17 00:48:16
Message-ID: 200509170048.j8H0mGC02332@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs wrote:
> > From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> > I don't see why printing the query cancel from a timeout is any more
> > special than a user request for cancel or a simple query error. If
> > users want statements to be printed on error, they will
> > configure things
> > that way, if not, we should not print them.
>
> The log is for admins, not users.
>
> If an admin sets statement_timeout, then it is a good idea to have the
> SQL logged as a way of gaining performance information for the *admin*,
> who knows less about what users do, yet is still charged with the need
> to tune if one user is effecting other users/jobs. That's a different
> scenario than a user cancelling their query. The user knows they've
> cancelled it, so they already know the SQL and can ask the admin if they
> want it faster. Generally the admin doesn't care if a user cancelled a
> query, since it might be for a whole host of reasons, whereas a query
> cancelled for statement_timeout has one specific cause.
>
> So, I still want this functionality, so the "bad" query is in the logs.

Well, the user can use use statement_timeout too, so it isn't just the
admin. Also, logging queries can be a security issue, so the idea of
logging the query on duration timeout by default seems like a bad idea.

We can go three ways. We can add a boolean GUC to control printing of
the query during a timeout, but that seems like overkill. We can add a
new level for log_min_error_statement that is just above error, but that
seems confusing. I think the right solution would be to allow
log_min_duration_statement to work for canceled queries. Right now,
log_min_duration_statement doesn't work for canceled queries because the
query never completes to give a final duration and hit the test code.
Should that be fixed now or added to the TODO list?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message William ZHANG 2005-09-17 02:49:19 Re: Time to close hackers-win32?
Previous Message Jonah H. Harris 2005-09-16 21:30:02 Re: Why does VACUUM FULL bother locking pages?