Wednesday, May 2, 2012

Why is peeking into BLOBs via getBytes(long pos, int length) so slow on an H2 database?

I have an application that needs to peek into blobs get out small numbers of bytes (via getBytes(long pos, int length)). The blobs are ~30MB. When I ask for bytes near the beginning of the blob, the performance is reasonable. When I ask for bytes near the end of the blob, the performance is much worse. Looking at the source code (JdbcBlob.java) it appears that the blob is read sequentially instead of randomly (via an input stream).



Does anybody know of any workarounds? I'm a huge H2 fan and this issue isn't a deal breaker but I think it could be improved.



Thanks





No comments:

Post a Comment