SQL: removed superfluous transactions to avoid some dead locks