Optimization and transaction log purge