Increasing speed of blob insert to oracle table

时间:2015-07-31 19:39:22

标签: java oracle

I am working on a java application that reads files from a cd and uploads each file as a blob to an oracle table. The application runs quite slow, only inserting 10-20 files per second. I am looking for a way to speed up this rate of inserting.

1 个答案:

答案 0 :(得分:2)

The first step of such an exercise is to identify why it is slow, or to put it another way, you need to find the bottleneck before you can improve anything. There are several things that could be causing a bottleneck in your application:

  1. Reading from the CD. If this is the bottleneck, the only way I know of to speed this up is to buy a new CD drive.
  2. Your java application. If this is the bottleneck, you could speed it up by using multiple threads to insert the items into the database.
  3. The Oracle Database. I doubt that this is the bottleneck, and if it is I wouldn't be able to say how to speed it up.

In order to find the bottleneck, you should eliminate the possibilities one by one:

  1. Eliminate the CD drive by pre-loading all (or as many as you can to get a good idea of the speed) into memory in your app before you start your timer (I assume you have a way of timing this as you mention a rate in the question). If it is still slow, then the CD player is not the issue.
  2. I wouldn't bother trying to eliminate the Oracle database as the cause - I would assume it is the Java application at this point and crank up the number of threads doing the work until the database falls over. You will probably find this speeds things up.

If neither of these things help, then it sounds like you might have the wrong database for the job. Oracle is a highly efficient enterprise grade piece of kit and if it isn't performing as fast as you expect then it's probably mis-configured or the files are larger than Oracle is designed for.