How to set h2 to stream resultset?

我与影子孤独终老i 提交于 2019-12-11 05:27:38

问题


Mysql driver has options to set so that resultset will not be read completely in memory as in here http://dev.mysql.com/doc/connector-j/en/connector-j-reference-implementation-notes.html#ResultSet.

Is there an equivalent option for H2?

Thanks,


回答1:


H2 currently does not support server side cursors. However, it buffers large result sets to disk (as a separate file, or as a temporary table). The disadvantage is speed, but it should not be a memory usage problems.

You can set the size of the when H2 will buffer to disk using set max_memory_rows. You can append that to the database URL: jdbc:h2:~/test;max_memory_rows=100000.

A workaround is usually to use "keyset paging" as described in the presentation "Pagination Done the Right Way". That would mean running multiple queries instead of one.

My plan is to implement server side cursors in H2 in the next months.



来源:https://stackoverflow.com/questions/24787119/how-to-set-h2-to-stream-resultset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!