When a user visits a page, you want to register various things in the database - Page Hit, etc. This may succeed in the same session, but you want page tracking to be reset to the database, even if an error subsequently occurs.
For better performance, you will also want your transactions to open as short as possible. During your request, you can perform many non-database operations, for which there is no reason to open a transaction.
Many other examples ...
source
share