[CONJ-173] [Feature Request] Implement a mechanism to bypass result set caching for streamed results Created: 2015-07-29 Updated: 2017-03-30 Resolved: 2017-03-30 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | None |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Minor |
| Reporter: | Geoffrey Rutherford | Assignee: | Diego Dupin |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Environment: |
JDBC |
||
| Issue Links: |
|
||||||||||||
| Description |
|
The streamed result set feature isn't usable in the MariaDB JDBC driver as it always creates a cached result set which means large result sets could consume large amounts of memory leading to out of memory failures. I've doctored the latest version for my own use to bypass result set caching on demand but it would be good if proper result set streaming was supported. |
| Comments |
| Comment by Diego Dupin [ 2015-07-29 ] |
|
Hi. |
| Comment by Vladislav Vaintroub [ 2015-07-29 ] |
|
Streaming used to work, without configurable fetch, one row at a time, documented in https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/#streaming-result-sets. |
| Comment by Diego Dupin [ 2015-07-29 ] |
|
Vlad, it's working as documented. no problem for that. Mysql connector is using 2 other parameters : defaultFetchSize and useCursorFetch that permit to use fetch size. |
| Comment by Vladislav Vaintroub [ 2015-07-29 ] |
|
I think the Geoffrey Rutherford's complaint was that it is not working at all, i.e all result sets are always fully loaded into memory. Glad to know this is not the case, and streaming actually does work. Arbitrary fetch size (rather than single row or all) could be an improvement in terms of flexibility and should not be too hard to do. That connectorJ's cursorFetch I believe (did not check) has very special meaning, by far not as broad as fetch size |
| Comment by Diego Dupin [ 2015-07-30 ] |
|
Geoffrey Rutherford will come back if it's not the case, but i've tested different things to check memory for I'm just beginning to implement "server" prepared statement, so that will permit to have fetch size on prepared statement. But, it leave 2 questions :
Second : Using rewriteBatchedStatements parameter: the goal is to avoid using network for DB with a big network latency. |
| Comment by Vladislav Vaintroub [ 2015-07-30 ] |
|
On server prepared statement, there was some work done last year as part of Summer of Code. Massimo was the mentor, Maybe you can reuse some of that (it is probably here https://code.launchpad.net/~puneetd30/mariadb-java-client/mariaDB_connector_gsoc ), I never have checked the code. To the questions : 1. fetch size does not actually need server side support like COM_STMT_FETCH. 2. Rewrite batch with prepared statements.. There is no fetch size involved. Batch is primarily there for updates, for SELECTs there is no way to read result sets during or after executeBatch() server prepared statements do not seem to make much sense, because they are not reused. |
| Comment by Diego Dupin [ 2017-03-30 ] |
|
Hi Geoffrey Rutherford, Be free to comment that if you have any issues left. |