File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Locking on multiple simultaneous inserts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Locking on multiple simultaneous inserts" Watch "Locking on multiple simultaneous inserts" New topic

Locking on multiple simultaneous inserts

Onkar Joshi
Ranch Hand

Joined: Mar 01, 2007
Posts: 116
I am reading messages from a JMS queue. Each message from the queue translates to an insert on a table that has no index and no PK.

My problem is that the inserts are getting serialized resulting in messages being consumed very slowly. (While messages are put into the queue much faster)

So are inserts on a table always serialized or under certain conditions? What?

Would appreciate any insight here!

SCJP 5 - 95% | SCWCD 1.4 - 88% | SCBCD 5 - 93%
Onkar Joshi's blog | LinkedIn profile
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

What are your settings? In particular, the transactions settings and the number of current messages being taken off the queue.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Casttro Francis

Joined: Oct 08, 2008
Posts: 25
I agree that the MDB will pick a message from the Queue Asynchronously. Use data source for better performance

And the important thing here for Performance

1. Try to develop a PL SQL package and insert messages Using a bulk insert. And the PL SQL package using Callable stmt.
2. Or use Execute Update.

If this not suits your requirement. Explain more detail about your requirements.

Any fool can write code that a computer can understand. Good programmers write code that humans can understand....
Onkar Joshi
Ranch Hand

Joined: Mar 01, 2007
Posts: 116
We managed a huge boost in performance by using multiple partitions for our target table.

I agree there are other things that can be done for further improvements. But the one above required almost no effort on our part other than finding out that doing that would improve things.
I agree. Here's the link:
subject: Locking on multiple simultaneous inserts
It's not a secret anymore!