I haven't used persistent
myself, but the Yesod book mentions that
One important thing to note is that everything which occurs inside a single call to
runSqlConn
runs in a single transaction. This has two important implications:
For many databases, committing a transaction can be a costly activity. By putting multiple steps into a single transaction, you can speed up code dramatically.
If an exception is thrown anywhere inside a single call to
runSqlConn
, all actions will be rolled back (assuming your backend has rollback support).
Whether this gives you isolation guarantees probably depends on whether the given back-end gives isolation guarantees for transactions.