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@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