PagingItemReader vs CursorItemReader in Spring batch -
i have spring batch multiple steps, sequential , parallel. of these steps involve fetching millions of rows , query has multiple joins , left joins. tried using jdbcpagingitemreader order clause hangs query. don't results after 30 minutes of waiting. switched jdbccursoritemreader. approach fine ? understand jdbccursoritemreader fetches data @ once , writes out based on commit interval. there option specify reader fetch, say, 50000 records @ time, application , system not overloaded ?
thank response, michael. have 22 customized item readers extended jdbccursoritemreader. if there multiple threads, how spring batch handle resultset? there possibility of multiple threads reading same resultset in case, also?
the jdbccursoritemreader
has ability configure fetchsize (how many records returned db each request), depends on database , it's configuration. example, databases can configure fetch size , it's honored. however, mysql requires set fetch side integer.min_value
in order stream results. sqlite has special requirements.
that being said, important know jdbccursoritemreader
not thread safe (multiple threads reading same resultset
).
i advocate tuning query assuming above conditions, should able use jdbccursoritemreader
fine.
Comments
Post a Comment