pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <noreply@github.com>
To: pgsql-jdbc@lists.postgresql.org
Subject: [pgjdbc/pgjdbc] ff22a3: feat: implement adaptive fetching (#1718)
Date: Fri, 13 Nov 2020 08:08:29 -0800
Message-ID: <pgjdbc/pgjdbc/push/refs/heads/master/0b74ae-ff22a3@github.com> (raw)

  Branch: refs/heads/master
  Home:   https://github.com/pgjdbc/pgjdbc
  Commit: ff22a3c31bb423b08637c237cb2e5bc288008e18
      https://github.com/pgjdbc/pgjdbc/commit/ff22a3c31bb423b08637c237cb2e5bc288008e18
  Author: Dave Cramer <davecramer@gmail.com>
  Date:   2020-11-13 (Fri, 13 Nov 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/AdaptiveFetchCache.java
    A pgjdbc/src/main/java/org/postgresql/core/v3/adaptivefetch/AdaptiveFetchCacheEntry.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/AdaptiveFetchCacheTest.java
    M pgjdbc/src/test/java/org/postgresql/jdbc/AbstractArraysTest.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: implement adaptive fetching (#1718)

* 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 seperate 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 made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Fix of type start in HashMap in constructor of AdaptiveFetchQueryMonitoring

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Documentation update in file connect.md

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

More explanation for setMaxRowSize method in PGStream class.

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Commit to add:
- unit tests for AdaptiveFetchQueryMonitoring class;
- some style fixes (removing extra spaces, simpler code in setMaxRowSize method in PGStream class).

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Commit to add:
- integration tests for adaptive fetching process;
- change casting to from primitive types to Wrapper classes in AdaptiveFetchQueryMonitoringTest.

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

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 made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Commit to add explanation about adaptive fetching process in AdaptiveFetchQueryMonitoring class.

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Style changes in code of adaptive fetch:
- change usage of "BOOLEAN.true" to "true";
- change usage of "localAdaptiveFetch == true" to "localAdaptiveFetch";
- removed swallowing all exceptions in QueryExecutorImpl methods;
- renamed "AdaptiveFetchQueryMonitoring" class to "AdaptiveFetchCache";
- renamed "AdaptiveFetchQueryInfo" class to "AdaptiveFetchCacheEntry";
- change of variables names for consistent naming in AdaptiveFetchCache;
- change of variable names to show unit for variables containing maximum row size;
- new methods in AdaptiveFetchCacheEntry class for increment/decrement counter;
- change in comments to be consistent with existing comments.

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Commit to add:
- missing methods for EncodingConnection in AbstractArraysTest.java;
- checking for NULL objects in adaptive fetch logic code in QueryExecutorImpl and PgResultSet;
- added NonNull annotation for Query parameters for methods in AdaptiveFetchCache.

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Commit changed:
- swapped descriptions for ADAPTIVE_FETCH_MAXIMUM and ADAPTIVE_FETCH_MINIMUM in PGProperty enum;
- changed the comment for ADAPTIVE_FETCH property in PGProperty enum;
- removed the redundant comment for setAdaptiveFetch() method in PGConnection interface.

Commit made for Heimdall Data's request to implement adaptive fetching.

* feat: implementation of adaptive fetching

Commit changed:
- corrected the mistake in the comment for ADAPTIVE_FETCH property in PGProperty enum;
- brought back the comment for setAdaptiveFetch() method in PGConnection interface.

Commit made for Heimdall Data's request to implement adaptive fetching.

Co-authored-by: Adrian Kloskowski <adrian.kloskowski@heimdalldata.com>







Message-ID: <pgjdbc/pgjdbc/push/refs/heads/master/0b74ae-ff22a3@github.com>
Permalink:  ../pgjdbc%2Fpgjdbc%2Fpush%2Frefs%2Fheads%2Fmaster%2F0b74ae-ff22a3@github.com/
Also on:    postgresql.org/message-id/pgjdbc/pgjdbc/push/refs/heads/master/0b74ae-ff22a3@github.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: noreply@github.com
  Subject: Re: [pgjdbc/pgjdbc] ff22a3: feat: implement adaptive fetching (#1718)
  In-Reply-To: <pgjdbc/pgjdbc/push/refs/heads/master/0b74ae-ff22a3@github.com>
  References: <pgjdbc/pgjdbc/push/refs/heads/master/0b74ae-ff22a3@github.com>

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

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