public inbox for [email protected]  
help / color / mirror / Atom feed
From: Etsuro Fujita <[email protected]>
To: jiye <[email protected]>
Cc: David G. Johnston <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Re: Re: FDW connection drops with "Connection timed out" during async append query due to TCP receive buffer filling up
Date: Sun, 12 Apr 2026 16:05:25 +0900
Message-ID: <CAPmGK17zmpCP6NAWWuQ9tPQpvLBRs6FDCMKxd37Chw_81ZnueQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CAKFQuwYcEvfna4HUkG9VkX0cR_xbRRhT_0qDaAHhrJ4UX0EW-g@mail.gmail.com>
	<[email protected]>
	<CAPmGK157wTfup6Jqt7K1p1=S0kGoBRSeQ1M50fLt93tcF1NQ5w@mail.gmail.com>
	<[email protected]>

On Fri, Apr 3, 2026 at 12:13 PM jiye <[email protected]> wrote:
> We have successfully reproduced this issue and gained a clearer understanding of its root cause. The application uses a cursor to fetch partial results in batches, with a delay between consecutive fetch operations. When the interval between two batches exceeds the tcp_user_timeout threshold, the connection is terminated unexpectedly.

I think that that is *expected* behavior.

> In my analysis, during cursor-based queries, applications typically retrieve results in partial batches. If the number of rows fetched in a single batch is smaller than the number of rows scanned from the local table, the executor is unable to proceed with fetching rows from the foreign table.

IIRC, I don't think that Append in async mode has such a limitation;
it chooses the next partition to scan independently of the number of
rows returned from it.  No?

> To achieve a fundamental resolution, I propose two potential solutions:
>
> ‌Alternate Row Fetching‌: Modify the executor to alternately retrieve rows from the local table and the foreign table, ensuring balanced data flow between the two data sources.
> ‌Asynchronous Tuple Storage‌: Implement a tuple storage mechanism to asynchronously cache results from the foreign table. This would allow the executor to fetch foreign table results into the storage buffer independently, preventing TCP window exhaustion and decoupling the dependency between local and foreign data retrieval.

I suppose that these are improvements, but I'm not sure these are
really worth complicating the code, as what you are trying to solve by
these is not a normal case; in particular, it's far from normal to set
a tcp_user_timeout that the query cannot finish.

Anyway, thanks for sharing the analysis and ideas!  Sorry for the delay.

Best regards,
Etsuro Fujita






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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Re: Re: FDW connection drops with "Connection timed out" during async append query due to TCP receive buffer filling up
  In-Reply-To: <CAPmGK17zmpCP6NAWWuQ9tPQpvLBRs6FDCMKxd37Chw_81ZnueQ@mail.gmail.com>

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

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