The batch processing in hibernate has little effect on the delete sql request
The problem is that the delete sql request are not sorted and therefore the batch processing cannot work at its best performance
It should be possible to specify that we want the delete commands to be sorted.
It would be like what can be done for the insert and update commands (option order_insert and order_update)
A new option should be added order_delete and if this option is activated, the delete order would be sorted.
For your information, we tested the sorting of delete orders by modifying the sortAction() methods of the org.hibernate.engine.ActionQueue as follo :
The overall performance of the deletions was greatly improve
@SuppressWarnings({ "unchecked" })
public void sortActions() {
if ( session.getFactory().getSettings().isOrderUpdatesEnabled() ) {
//sort the updates by pk
java.util.Collections.sort( updates );
}
if ( session.getFactory().getSettings().isOrderInsertsEnabled() ) {
sortInsertActions();
}
java.util.Collections.sort( deletions );
}
|