Обсуждение: How to log canceled SQL statement due to statement timeout

Поиск
Список
Период
Сортировка

How to log canceled SQL statement due to statement timeout

От
Eric Comeau
Дата:
We currently have statement timeout set

       statement_timeout = 10800000  # 3 hrs

and we receive the following in the postgresql.log

   [1-1] ERROR:  canceling statement due to statement timeout

Is there a way to have the SQL statement logged as well?

We have set the log_min_duration_statement = 5000 to log any SQL
statement that takes longer than 5 secs and this works when the
statement complete.

We are using version 8.1.17

Thanks,
Eric

Re: How to log canceled SQL statement due to statement timeout

От
"Kevin Grittner"
Дата:
Eric Comeau <ecomeau@signiant.com> wrote:

> We currently have statement timeout set
>
>        statement_timeout = 10800000  # 3 hrs
>
> and we receive the following in the postgresql.log
>
>    [1-1] ERROR:  canceling statement due to statement timeout
>
> Is there a way to have the SQL statement logged as well?

log_min_error_statement = 'ERROR'

-Kevin

Re: How to log canceled SQL statement due to statement timeout

От
Eric Comeau
Дата:
On 11-04-13 12:37 PM, Kevin Grittner wrote:
> Eric Comeau<ecomeau@signiant.com>  wrote:
>
>> We currently have statement timeout set
>>
>>         statement_timeout = 10800000  # 3 hrs
>>
>> and we receive the following in the postgresql.log
>>
>>     [1-1] ERROR:  canceling statement due to statement timeout
>>
>> Is there a way to have the SQL statement logged as well?
>
> log_min_error_statement = 'ERROR'
>
> -Kevin
>
This solved the problem. Thanks Kevin.

I was surprised to discover that the default for log_min_error_statement
is PANIC on 8.1, it appears they have changed the default from 8.2+ to
ERROR now.

Eric