Optimizing the transaction log