Performance Impact of rollback() Immediately after a commit().
Posted by: Scott Andrews
Date: April 18, 2018 07:47AM

Recently our team moved to the following approach (we have valid reasons why and my question is not about this solution):

try (DbSession session = daoFactory.openSession()) {

// JDBC Execution with session.getConnection()

// Explicit commit required for inserts/updates/deletes
// No explicit commit required for selects
}

Our DbSession object wraps a JDBC Connection and implements AutoCloseable. Our close() implementation always calls connection.rollback() (again for reasons that are independent of my question).

The net effect is we either have inserts/updates/deletes with a commit, which is immediately followed by a rollback

Or, we have selects which are just followed by a rollback.

My question is about the performance impact of calling rollback() immediately after a commit(), and if there are any?

So what is the impact of doing a commit and then a rollback on performance for a production environment? Is it zero or is it something that we should consider? Does the JDBC driver handle this as a NOOP (I hope so)? Or is this an actual networked call to the database server?

Thanks!!!!

Options: ReplyQuote


Subject
Written By
Posted
Performance Impact of rollback() Immediately after a commit().
April 18, 2018 07:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.