azexcy opened a new issue, #24150:
URL: https://github.com/apache/shardingsphere/issues/24150

   ## Question
   
   When i use streaming query at `ShardingSphere-JDBC`, it's may not take 
effect. whether it takes effect is controlled by `ConnectionMode` at 
ExecuteQueryCallback
   <img width="1296" alt="image" 
src="https://user-images.githubusercontent.com/101622833/218620872-5fa7dd7c-39bd-49a0-a533-e2849873eab8.png";>
   
   The JDBCMemoryQueryResult will load all records at memory, not like 
streaming query.
   ```
   public final class JDBCMemoryQueryResult extends AbstractMemoryQueryResult {
       
       public JDBCMemoryQueryResult(final ResultSet resultSet, final 
DatabaseType databaseType) throws SQLException {
           super(new JDBCQueryResultMetaData(resultSet.getMetaData()),
                   
TypedSPILoader.getService(DialectQueryResultDataRowLoader.class, 
databaseType.getType()).load(resultSet.getMetaData().getColumnCount(), 
resultSet));
       }
   }
   
   public abstract class AbstractQueryResultDataRowLoader implements 
DialectQueryResultDataRowLoader {
       
       @Override
       public Collection<MemoryQueryResultDataRow> load(final int columnCount, 
final ResultSet resultSet) throws SQLException {
           Collection<MemoryQueryResultDataRow> result = new LinkedList<>();
           while (resultSet.next()) {
               List<Object> rowData = new ArrayList<>(columnCount);
               for (int columnIndex = 1; columnIndex <= columnCount; 
columnIndex++) {
                   Object rowValue = loadRowValue(resultSet, columnIndex);
                   rowData.add(resultSet.wasNull() ? null : rowValue);
               }
               result.add(new MemoryQueryResultDataRow(rowData));
           }
           return result;
       }
   ```
   
   the `ConnectionMode` value depend on maxConnectionsSizePerQuery, (default 
value is 1).
   
   <img width="1405" alt="image" 
src="https://user-images.githubusercontent.com/101622833/218621061-1864c627-c2a6-4dc7-b15d-fa95c34d8180.png";>
   
   If i want to use the streaming query, is there a better way increasing 
maxConnectionsSizePerQuery (because the size of this value is not easy to set)?
   
   eg. MySQL streaming query parameter
   ```
          PreparedStatement result = connection.prepareStatement(sql, 
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
           result.setFetchSize(Integer.MIN_VALUE);
           return result;
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to