Re: statement_timeout affects query results fetching? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: statement_timeout affects query results fetching?
Date
Msg-id 28985.1439046816@sss.pgh.pa.us
Whole thread Raw
In response to statement_timeout affects query results fetching?  (Shay Rojansky <roji@roji.org>)
Responses Re: statement_timeout affects query results fetching?  (Shay Rojansky <roji@roji.org>)
List pgsql-hackers
Shay Rojansky <roji@roji.org> writes:
> Hi everyone, I'm seeing some strange behavior and wanted to confirm it.
> When executing a query that selects a long result set, if the code
> processing the results takes its time (i.e.g more than statement_timeout),
> a timeout occurs. My expectation was that statement_timeout only affects
> query *processing*, and does not cover the frontend actually processing the
> result.

Are you using a cursor, or something like that?

libpq ordinarily absorbs the result set as fast as possible and then hands
it back to the application as one blob; the time subsequently spent by the
application looking at the blob doesn't count against statement_timeout.

As Robert says, statement_timeout *does* include time spent sending the
result set to the client, and we're not going to change that, because it
would be too hard to disentangle calculation from I/O.  So if the client
isn't prompt about absorbing all the data then you have to factor that
into your setting.  But it would be a slightly unusual usage pattern
AFAIK.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: WIP: SCRAM authentication
Next
From: Shay Rojansky
Date:
Subject: Re: statement_timeout affects query results fetching?