Re: statement_timeout issue

From: Ian Harding <harding(dot)ian(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: General PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: statement_timeout issue
Date: 2018-05-05 15:31:04
Message-ID: CAMR4UwGC8iP4TjVLnwsEgfnLUozHv2LCyZ2WE4QHRq8WTrWVuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, May 4, 2018 at 10:22 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:

> Hi,
>
> On 2018-05-04 09:52:35 -0700, Ian Harding wrote:
> > I know there are a lot of moving parts to this issue but I think I've
> > eliminated most of them and the problem comes down to the postgresql
> server
> > generating a statement_timeout error after 10 seconds when the connection
> > statement_timeout is actually set to 15 minutes.
> >
> > My web server gets a database handle which it keeps for the duration of
> the
> > function that generates the response. Multiple queries can be sent and
> > will use the same handle.
> >
> > After getting the handle I issue "show statement_timeout" and log the
> > result which shows 15 minutes.
> >
> > 84876:May 4 08:31:06 seattle-vm-1-0 nsd: STATEMENT_TIMEOUT IS:
> > 84877-May 4 08:31:06 seattle-vm-1-0 nsd: statement_timeout = 15min
> >
> > Then I send a query, and it generates a statement_timeout error after 10
> > seconds.
> >
> > The log has a CONTEXT which indicates a foreign key lookup was going on
> at
> > the time which is fine...
> >
> > 2018-05-04 04:05:20 PDT [62028]: [82-1] ERROR: canceling statement due
> to
> > statement timeout
> > 2018-05-04 04:05:20 PDT [62028]: [83-1] CONTEXT: SQL statement "SELECT 1
> > FROM ONLY "public"."clients" x WHERE "c_id" OPERATOR(pg_catalog.=) $1 FOR
> > KEY SHARE OF x"
> > 2018-05-04 04:05:20 PDT [62028]: [84-1] STATEMENT: INSERT /*
> >
> > Is there anything I'm not thinking of?
>
> Probably some part of your application, or a function you're calling
> from there, is setting a different timeout.
>
>
That's what I thought, but I'm using the same db handle and only sending
plain SQL on base tables. Only triggers, rules and foreign keys should be
in play I think...

I don't remember setting a statement timeout in a trigger, that seems kind
of crazy.

> Greetings,
>
> Andres Freund
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2018-05-05 16:08:51 Re: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification
Previous Message Neto pr 2018-05-05 15:18:39 Re: comparison between 2 execution plans