What are the ways to code efficient transactions?- We shouldn't allow input from users during a transaction. - We shouldn't open transactions while browsing through data. - We should keep the transaction as short as possible. - We should try to use lower transaction isolation levels. - We should access the least amount of data possible while in a transaction.What are the ways to code efficient transactions?Some ways and guidelines to code efficient transactions: - Do not ask for an input from a user during a transaction. - Get all input needed for a transaction before starting the transaction. - Transaction should be atomic - Transactions should be as short and small as possible. - Rollback a transaction if a user intervenes and re-starts the transaction. - Transaction should involve a small amount of data as it needs to lock the number of rows involved. - Avoid transactions while browsing through data.
|