Senior |
![Senior Senior](./images/ranks/senior.gif) |
Joined: Sun Jan 04, 2004 2:46 pm Posts: 147
|
Hibernate version:
2.1.6
Name and version of the database you are using:
SQLServer 2000 + jtds
I've been playing around with the ScrollableResults and I had a few performance issues with it. The problem I have is that sometimes I need to select a very large number of rows out of the database and using find() or a Query often results in out of memory errors or the JVM running very slowly as it has to garbage collect massive amounts ( probably the lvl 1 cache filling up ).
In JDBC all I would do is get the ResultSet and stream the data off it to wherever I want it to go avoiding keeping large amounts in memory. 93k records takes about 3-3.5 seconds to load an instantiate the object manually.
I tried out the Scrollable results and doing the same thing ( using new XXX( ... ) rather than just "from XXX" ) it took roughly 25 seconds. I tweaked the hibernate source so for a scrollable query it would just create a normal PreparedStatement ( BatcherImpl.getPreparedStatement() ) and it only took 6.5 seconds. Much better. Side effect of this change is that a lot of the ScrollableResults scrolling functions will break.
Would it be possible/reasonable to have an overload for scroll() that specifies what sort of scrolling you want, so I could get a forward only/read only scroller that just moves along a ResultSet?
|
|