Re: statement_timeout logging

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: statement_timeout logging
Дата
Msg-id 200509170048.j8H0mGC02332@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: statement_timeout logging  ("Simon Riggs" <simon@2ndquadrant.com>)
Ответы Re: statement_timeout logging  (Simon Riggs <simon@2ndquadrant.com>)
Список pgsql-hackers
Simon Riggs wrote:
> > From: Bruce Momjian [mailto:pgman@candle.pha.pa.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@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Simon Riggs"
Дата:
Сообщение: Re: [DOCS] statement_timeout logging
Следующее
От: Bruce Momjian
Дата:
Сообщение: BEOS code