Simple question first - with MySql were you using MyIsam or Innodb as its storage engine? MyIsam isn't transactional so there would be none of the concurrency overhead involved with Oracle.
The difference in jdbc.batch_size
might be relevant depending on how many inserts your slow transactions are doing.
This variable defines how many records hibernate will attempt to insert at once when doing batch inserts. For example if you have a typical batch insert loop like the one below, hibernate will flush a batch of INSERT statements to the database every batch_size iterations. So in your oracle configuration you might be getting slower performance because you're sending 30/5 = 6 times as many batches than you were for MySQL which could give a performance hit if you're saving 1000s of records.
Code:
List<MyEntity> entitiesToSave = ...
int count;
for(MyEntity : entitiesToSave ) {
session.save(lookup);
count++
if(count% hibernate_batch_size == 0) {
session.flush();
}
}
Also, with MySQL there is a special flag you can set in the jdbc driver:
&rewriteBatchedStatements=true. If set then the driver converts each batch of INSERTs into a single high optimised mysql-specific bulk insert statement before sending the sql to the database.
I.e. instead of sending a batch of individual inserts like:
Code:
INSERT INTO myTable (a,b,c) VALUES (1,2,3); INSERT INTO myTable (a,b,c) VALUES (3,4,5); INSERT INTO myTable (a,b,c) VALUES (6,7,8);...
it will send a single bulk insert statement:
Code:
INSERT INTO myTable (a,b,c) VALUES (1,2,3), (4,5,6), (7,8,9) ...
For very large numbers of inserts this can make a big difference . I'm not sure if there are similar features available for the oracle jdbc driver (?).
(NB. if the entities you are inserting having auto-generated ids then the above probably doesn't apply - hibernate can't batch the inserts since there are problems obtaining the generated ids from batch inserts.)
...or something completely different could be happening :-/ It's very difficult to say without more information about your particular transactions/enties - could you give a bit more details/code examples of the slow operations?
Stephen