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-16 19:33:08
Message-ID: 200509161933.j8GJX8R13136@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs wrote:
> Currently, when we set a statement_timeout and a query runs over that
> time there is no log message to say that the statement has timed out. We
> do get a message which says
> ERROR: canceling query due to user request
> and so in the server log it is impossible to tell the difference between
> a query that has been cancelled deliberately by the user and a query
> whose time(out) has come.

I have updated the message to:

errmsg("canceling query due to user request or statement timeout")));

> The timeout causes the query to be cancelled, which is an ERROR, so it
> is possible that the query will be logged if log_min_error_statement is
> set to ERROR or below. Again, there is no way to tell the difference
> between an ERROR statement that has occurred during execution and an
> ERROR statement that is generated by a syntax error. So, if you do set
> log_min_error_statement=ERROR then you get swamped by syntax errors
> rather than being able to see statement timeouts.
>
> Logging these queries ought to be a valuable source of tuning
> information, but as a result of the above, this is not currently the
> case.
>
> For now, I've written a quick patch to the log the query text with a
> suitable error message.
>
> I expect some debate as to whether the line
> if (log_min_error_statement > WARNING)
> should be there at all, so comments are sought.

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.

--
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 Stephen Frost 2005-09-16 19:36:29 Re: Spinlocks, yet again: analysis and proposed patches
Previous Message Greg Stark 2005-09-16 18:35:03 Re: Spinlocks, yet again: analysis and proposed patches