Message-ID: From: "ash211 (@ash211)" To: "pgjdbc/pgjdbc" Date: Tue, 21 Feb 2023 22:57:54 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #2656: Adaptive Fetch doesn't enable ResultSet streaming In-Reply-To: References: List-Id: X-GitHub-Author-Login: ash211 X-GitHub-Comment-Id: 1439200147 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 2656 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/2656#issuecomment-1439200147 Content-Type: text/plain; charset=utf-8 If you remove the maxResultBuffer setting then I think adaptiveFetch is disabled. Per https://github.com/pgjdbc/pgjdbc/blob/2b90ad04696324d107b65b085df4b1db8f6c162d/README.md?plain=1#L145, `adaptiveFetch` > Requires declaring maxResultBuffer and defaultRowFetchSize for first iteration. ---------------- I recently ran into this, where I had set `adaptiveFetch=true` and `defaultRowFetchSize=10` and `maxResultBuffer=10percent` and yet still a user of my tool observed this failure message: `Result set exceeded maxResultBuffer limit. Received: 103887670; Current limit: 103887667` It seems that currently this JDBC driver requests "give me N rows" and gets back those N rows, regardless of their size. If postgres server supported such a thing, we may prefer "give me N rows or up to B bytes" and receiving 1..N rows instead of always N. This would enable smoother streaming of a ResultSet, without OOM or hitting `maxResultBuffer` limits while still maintaining reasonably large fetch sizes (not just 1 all the time).