db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikael Sundberg" <Mikael.Sundb...@artificial-solutions.com>
Subject RE: how to get data out from Clob?
Date Tue, 25 Nov 2008 12:41:25 GMT
Im using derby 10.4.2 and the clientdriver.
I changed from 
                BufferedReader r = new BufferedReader(new
                for (String line = r.readLine(); line != null; line =

	String data = res.getString("data");

In a recent update to our application since the getString seemed to be
twice as fast then. Not entirely sure what versions of derby I tested on
So bacisly I should change back now? We don't want to use any unstable
version on production so guess I will have to solve it some other way. 
Il atleast try out the latest version on my testservers to see if that
realy is the problem.

-----Original Message-----
From: Kristian.Waagan@Sun.COM [mailto:Kristian.Waagan@Sun.COM] 
Sent: den 25 november 2008 13:32
To: Derby Discussion
Subject: Re: how to get data out from Clob?

Mikael Sundberg write:
> We are having some trouble with retrieving data from big Clob fields. 
> The data is about 40-50MB and it takes forever to retrieve it.  
> Tried a lot of different methods, getString, getClob, getAsciiStream. 
> They all take forever (hours).
> When checking whats running in derby we find
> A lot of times.
> How should I retrieve large CLob fields fastest?

Hello Mikael,

You are being hit by a serious performance bug (a lot more prominent 
since Derby 10.3).
I understand you are using the client driver, but which version of Derby

are you using?

I believe the issue you are experiencing has been fixed in trunk and in 
the 10.4 branch, but a release hasn't been made after the fix was 
committed. If you don't want to build Derby yourself, *test binaries* 
are available if you want to test with a newer version. It should be 
sufficient to update the server side only (i.e. derbynet.jar and 
derby.jar). If you try it out, please remember to take a backup of your 
database! If you need to upgrade you database to trunk, you also need to

enable pre-release upgrades.

Unfortunately, there is no way to properly work around the problem in 
older releases. You can adjust the buffer/block size used to fetch data 
in the client application, but this will only help a little bit and will

probably not be sufficient.
The optimal buffer size is dependent on the Clob content (due to the 
UTF-8 encoding used). If your Clobs contain ASCII data, you should set 
your buffer size to 32672 (note that this is smaller than 32KB). If you 
are using the embedded driver, make sure you access the Clob using one 
of the streaming methods (getSubString has been fixed by now).
There will be several changes regarding Clob performance in the next 
feature release.

We're also in the progress of adding performance regression tests for 
LOBs, as this is a problem we should have detected a long time ago!
If you are still seeing the problem with the newest version, I'm very 
interested in getting more details from you.


View raw message