RE: Timeout parameters

From: MikalaiKeida(at)ibagroup(dot)eu
To: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Cc: "AYahorau(at)ibagroup(dot)eu" <AYahorau(at)ibagroup(dot)eu>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, "Jamison, Kirk" <k(dot)jamison(at)jp(dot)fujitsu(dot)com>, "Michael Paquier" <michael(at)paquier(dot)xyz>, "Nagaura, Ryohei" <nagaura(dot)ryohei(at)jp(dot)fujitsu(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: RE: Timeout parameters
Date: 2019-03-15 07:26:59
Message-ID: OF8503B6B7.A2DC877F-ON432583BE.00275173-432583BE.0028ECF7@iba.by
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Takayuki-san,

> Yes, so I think it would be necessary to describe how to set
socket_timeout with relation to other timeout parameters -- socket_timeout
> statement_timeout, emphasizing that socket_timeout is not for canceling
long-running queries but for returning control to the client.

For me it does not look enough.
If you would like to implement the 'socket_timeout' parameter, could you
pay attention on the Fabien Coelho comment?

> The fact that no answer data is received may mean that it takes time to
> compute the result, so cancelling seems appropriate to me, rather than
> severing the connection and starting a new one immediately, leaving the
> server loaded with its query.

This comment is very important to pay attention on.
Let's imagine once more:
1. end-user makes a query
2. the query has not completed within this timeout due to any reason: the
query is too 'heavy', some problem with OS happened, PostgreSQL server
terminated
3. if we simple close connection, the first case is negative by mistake.
To avoid such a situation I think it would be better to call a PQcancel().
In case of failure PQcancel() terminates in 'socket_timeout'. So, control
to the end-user in such a failure situation will be returned in 2 *
'socket_timeout' interval. It is much better than hanging forever in some
specific cases. Moreover, such solution will not lead to the overloading
of PostgreSQL server by abnormally ignored 'heavy' queries results by
end-users.

What do you think about it?

Best regards,
Mikalai Keida

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2019-03-15 07:32:22 Re: hyrax vs. RelationBuildPartitionDesc
Previous Message Michael Paquier 2019-03-15 07:23:56 Re: Fix typo in test code comments