Java JDBC Lazy-Loaded ResultSet

后端 未结 5 999
死守一世寂寞
死守一世寂寞 2020-12-08 00:48

Is there a way to get a ResultSet you obtain from running a JDBC query to be lazily-loaded? I want each row to be loaded as I request it and not beforehand.

5条回答
  •  甜味超标
    2020-12-08 01:35

    There is an answer provided here.

    Quote:

    The Presto JDBC driver never buffers the entire result set in memory. The server API will return at most ~1MB of data to the driver per request. The driver will not request more data from the server until that data is consumed (by calling the next() method on ResultSet an appropriate number of times).

    Because of how the server API works, the driver fetch size is ignored (per the JDBC specification, it is only a hint).

    Prove that the setFetchSize is ignored

提交回复
热议问题