pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: harding.ian@gmail.com
To: General PostgreSQL List <pgsql-general@postgresql.org>
Subject: Re: statement_timeout issue
Date: Fri, 4 May 2018 11:28:35 -0700
Message-ID: <1841c2b1-78f2-27f2-8e20-9c7b39a85e11@aklaver.com> (raw)
In-Reply-To: <CAMR4UwHARJ-m9=wKDy_mg+tJsuzsmQWOVguFyROO5GaF8rxGqg@mail.gmail.com>
References: <CAMR4UwHARJ-m9=wKDy_mg+tJsuzsmQWOVguFyROO5GaF8rxGqg@mail.gmail.com>

On 05/04/2018 09:52 AM, 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.

To follow up on Andres's suggestion, when you do the above do:

select * from pg_settings where name = 'statement_timeout';

and see what the source field is pointing to.


> 
> 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?
> 
> Thanks!
> 
> - Ian


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (4+ messages)  latest in thread

Message-ID: <1841c2b1-78f2-27f2-8e20-9c7b39a85e11@aklaver.com>
Permalink:  ../1841c2b1-78f2-27f2-8e20-9c7b39a85e11@aklaver.com/
Also on:    postgresql.org/message-id/1841c2b1-78f2-27f2-8e20-9c7b39a85e11@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, harding.ian@gmail.com
  Subject: Re: statement_timeout issue
  In-Reply-To: <1841c2b1-78f2-27f2-8e20-9c7b39a85e11@aklaver.com>
  References: <CAMR4UwHARJ-m9=wKDy_mg+tJsuzsmQWOVguFyROO5GaF8rxGqg@mail.gmail.com> <1841c2b1-78f2-27f2-8e20-9c7b39a85e11@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox