Subject Re: Blob Performance hints?
Author Roman Rokytskyy
> Are you using subType 0 (bin) or 1 (text)? I initially created the
> blob field as subType 0, will this cause problems with rs.getString?

Currently you have good chances of getting your data with
str.getBytes() back only if client's encoding is NONE and no
manipulation with string is performed. In this case string still keeps
all data even some bytes are not defined in the default JVM character
set. I do not know if this behaviour stays forever.

> > Check if ResultSet.getBytes(int) works faster (only as a test).
> I was getting about 0.2 meg per second. After I tried this it
> increased to about 1.0 meg per sec.
> I think the rest of the difference can be attributed to the overhead
> of the servlet engine, etc.

Can you measure the database performance by reading data with
ResultSet.getBinaryStream(int) and sending them to /dev/null? Maybe
this is the servlet container/network that does not like 1k blocks in

> Why did you say to use only use ResultSet.getBytes(int) as a test?
> Is there a problem with using it?

Do you have so much memory in your servlet container than you happily
can keep 10x20Mb byte arrays in RAM? ResultSet.getBytes(int) fetches
all data at once and keeps it in memory. This will work for one user,
but it is not scalable.

Best regards,