Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j6EFl-0001d9-5J for pgsql-jdbc@arkaria.postgresql.org; Mon, 24 Feb 2020 13:58:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j6EFk-0004EI-11 for pgsql-jdbc@arkaria.postgresql.org; Mon, 24 Feb 2020 13:58:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j6EFj-0004E9-NM for pgsql-jdbc@lists.postgresql.org; Mon, 24 Feb 2020 13:58:31 +0000 Received: from out-19.smtp.github.com ([192.30.252.202]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6EFe-0001qx-GS for pgsql-jdbc@lists.postgresql.org; Mon, 24 Feb 2020 13:58:31 +0000 Date: Mon, 24 Feb 2020 05:58:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1582552704; bh=Jb2XX1JByNUFKkPRJW1lfOUslU20+5peluEkQ2DTvt4=; h=Date:From:To:Subject:From; b=A1rt6LSBr1qaBxFeS94OxM/IXL6Q7cXPVhFIRObeg7XfVAn8d5z049B509a1lXLNh 5vCIZzMwIx2q54roEWpNUkQuHv1SqCq1ioQpY+52L1y4rV8yDsw+vOoOMvoryU4267 jLFwllLFPvVAY4dW4dU8ZEncbI45v/hVXZOX329c= From: adrklos To: pgsql-jdbc@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] 5bb5f4: feat: implementation of adaptive fetching (#1707) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Approved: 58GruLoMopuc X-GitHub-Recipient-Address: pgsql-jdbc@lists.postgresql.org X-Auto-Response-Suppress: All List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Branch: refs/heads/master Home: https://github.com/pgjdbc/pgjdbc Commit: 5bb5f409b8372e4be86c14a00309ab60b8e17ed8 https://github.com/pgjdbc/pgjdbc/commit/5bb5f409b8372e4be86c14a00309ab60b8e17ed8 Author: adrklos Date: 2020-02-24 (Mon, 24 Feb 2020) Changed paths: M README.md M docs/documentation/head/connect.md M pgjdbc/src/main/java/org/postgresql/PGConnection.java M pgjdbc/src/main/java/org/postgresql/PGProperty.java M pgjdbc/src/main/java/org/postgresql/PGStatement.java M pgjdbc/src/main/java/org/postgresql/core/PGStream.java M pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java M pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java A pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryInfo.java A pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoring.java M pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java M pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java M pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java M pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java A pgjdbc/src/test/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchQueryMonitoringTest.java M pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java A pgjdbc/src/test/java/org/postgresql/test/jdbc42/AdaptiveFetchSizeTest.java M pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42TestSuite.java Log Message: ----------- feat: implementation of adaptive fetching (#1707) * feat: implementation of adaptive fetching Implementation of adaptive fetching logic during process of fetching result set. Change adds three new properties used with adaptive fetching: - adaptiveFetch - use to enable/disable work of adaptive fetching - adaptiveFetchMinimum - use to define minimum size computed during adaptive fetching - adaptiveFetchMaximum - use to define maximum size computed during adaptive fetching Adaptive fetching is used to compute fetch size to fully use size defined by maxResultBuffer. Computing is made by dividing maxResultBuffer size by max row result size noticed so far. Each query have separate adaptive fetch size computed, but same queries have it shared. If adaptive fetch is turned on, first fetch is going to be made with defaultRowFetchSize, next fetching of resultSet will be made with computed adaptive fetch size. If adaptive fetch is turned on during fetching, then first fetching made by ResultSet will be made with defaultRowFetchSize, next will use computed adaptive fetch size. Additionally, resultSet have new method - getLastUsedFetchSize to get fetch size used during last fetching. If adaptive fetching is turned on, then getFetchSize will return lastUsedFetchSize. Property adaptiveFetch need properties defaultRowFetchSize and maxResultBuffer to work. Commit to add: - unit tests for AdaptiveFetchQueryMonitoring class; - some style fixes (removing extra spaces, simpler code in setMaxRowSize method in PGStream class). Commit to add: - integration tests for adaptive fetching process; - change casting to from primitive types to Wrapper classes in AdaptiveFetchQueryMonitoringTest. Change in AdaptiveFetchSizeTest: - is using PreparedStatement during tests now; - added assume to check if preferQueryMode is not Simple; - new method to open connection and creating table to remove code repetitiveness. Commit to add explanation about adaptive fetching process in AdaptiveFetchQueryMonitoring class.