Hello,

On 10/18/07, Kristian Waagan <Kristian.Waagan@sun.com> wrote:
Templexp Tan wrote:
> Is it any optimization for BATCH queries for Derby?
>
> how about the speed for inserts?
> which one will be suitable for batchquery?  the statement or
> preparestatement ?
>
> it seems a little bit slow to insert a bunch of data into the DB.
> it is about 7ms for ORACLE (100 queries in batch)
> but it tooks 20ms for DERBY (100 queries in batch)
> and the worse case is that it goes slower and slower if I have more than
> 30000 rows data in it.
> there is one index in the table. I don't think it gonna cost too much.
>
> any idea to speed up?

Hello,

Questions like these are generally hard to answer without knowing the
full story. Also, I don't know Oracle.

A few thoughts:
  * Are you using Derby embedded or client/server?

it is c/s base DB.
 

  * Is the load program singlethreaded or multithreaded?

probably multi, but might not be in a single program.
 

  * Are the data and the log written to separate devices? (set with logDevice in the connection URL upon creation)

it should be in the same device. do you mean the operation log, or the database record log? any documentation about the log, or it could be optimized the performance. 

  * Do you run with autocommit off in both databases? If yes, how often
do you commit?

no, it is operation by manually, only once after the execute batch.

  * How big (approx) are your rows?

it is about less than 4k per row.
 

  * Have you adjusted the page cache size?

it  is 10000.

  * What about the Java heap size and garbage collection?

512MB for java heap. and didn't optimized any thing about the gc. any help on this?

  * Java version?

Java 6 Update 2

  * Derby version?

10.3.1.4


 

That's what I can think of right now. Maybe someone else chimes in with
suggestions too. If you post the code, it might be easier to see if
anything can be done to speed up Derby.


regards,
--
Kristian

>
>

thanks your helps
Regards,
Temple