Description:
We're observing that DuckDB completes the PostgreSQL scan relatively quickly (10–20 seconds), but the query itself involves complex joins and unnesting that take several minutes to process entirely within DuckDB. During this processing time, the PostgreSQL connection remains open but idle — it isn't released until the entire query completes.
The problem is that PostgreSQL (or an intermediate proxy/firewall) terminates the idle connection before DuckDB finishes processing, which causes the entire query to fail. Since the scan data has already been fully read into DuckDB at that point, the connection is no longer needed and should ideally be released as soon as the scan phase completes.
Description:
We're observing that DuckDB completes the PostgreSQL scan relatively quickly (10–20 seconds), but the query itself involves complex joins and unnesting that take several minutes to process entirely within DuckDB. During this processing time, the PostgreSQL connection remains open but idle — it isn't released until the entire query completes.
The problem is that PostgreSQL (or an intermediate proxy/firewall) terminates the idle connection before DuckDB finishes processing, which causes the entire query to fail. Since the scan data has already been fully read into DuckDB at that point, the connection is no longer needed and should ideally be released as soon as the scan phase completes.