-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDBC-level pagination/streaming of large queries #142
Comments
I experienced connectivity timeouts for Delete task (imagine, there was a quite slow stage listener causing data have been processed about 2-3 hours). Though useCursorFetch=true&defaultFetchSize=500 params were on JDBC URL. Per a log I noted that failing it complained on the first query which selected all targets: |
Changed behaviour in decorated DeleteTask resolves a connection timeout issue: when com.nhl.link.move.runtime.task.delete.DeleteTask.createTargetSelect() returns com.nhl.link.move.runtime.task.delete.CollectionResultIterator as org.apache.cayenne.ResultIterator then job result is successful. Otherwise it might fail fail like this way with MySQL & HikariCP:
|
@vitalz : could you post your code changes that help to address the problem? |
|
When reading large datasets (e.g. inside
CreateOrUpdateTask.getRowReader()
/JdbcExtractor.getReader()
), we are using Cayenne iterator, still the underlying DB may read the entire ResultSet in memory. This causes two problems:A Cayenne side of this should use
SQLSelect.statementFetchSize(batchSize)
. But some DBs may require extra settings at the JDBC level for this flag to take effect. Specifically MySQL requires this:So the goal of this task is to either figure out a transparent solution for JDBC-level result streaming or develop a set of simple recipes for MySQL, PostgreSQL, SQLServer as most common DB engines on how to solve it (e.g. via URL parameters, etc.) Or provide some combination of the two. (See a MySQL recipe below in comments).
The text was updated successfully, but these errors were encountered: