Message-ID: From: "davecramer (@davecramer)" To: "pgjdbc/pgjdbc" Date: Tue, 21 Mar 2023 16:18:01 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #2861: setFetchSize is ignored? In-Reply-To: References: List-Id: X-GitHub-Author-Login: davecramer X-GitHub-Comment-Id: 1478157167 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 2861 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/2861#issuecomment-1478157167 Content-Type: text/plain; charset=utf-8 There are a number of conditions documented in https://jdbc.postgresql.org/documentation/query/ that are pre-requisites to fetch size being honoured. The connection to the server must be using the V3 protocol. This is the default for (and is only supported by) server versions 7.4 and later. The Connection must not be in autocommit mode. The backend closes cursors at the end of transactions, so in autocommit mode the backend will have closed the cursor before anything can be fetched from it. The Statement must be created with a ResultSet type of ResultSet.TYPE_FORWARD_ONLY. This is the default, so no code will need to be rewritten to take advantage of this, but it also means that you cannot scroll backwards or otherwise jump around in the ResultSet. The query given must be a single statement, not multiple statements strung together with semicolons.