Question

I'm using Percona server (MySQL), currently developing a network desktop application with multiple users who using the application. My application database innodb with Transactions but I have problem in choosing which Transaction-Isolation i have to use, my application is sensitive since it has a financial records. So, could someone help me to decide which Transaction-Isolation I have to use?

Was it helpful?

Solution

@deceze and @zerkms are correct - it isn't the nature of your data that determines the best transaction isolation. It's the nature of your application and its queries. You may even find cases of using both isolation levels within the same application.

Repeatable-read transactions ensure that you can query the same data more than once during a given transaction, and your queries will return unchanging data -- even if the data is being changed by other sessions in the meantime. Your session will not see those changes, even if they have been committed, until your session starts a new transaction. This is useful, for example, for a logical dump of all data. Also complex reports that take several steps, and you need to read the same tables multiple times.

Read-committed also allows other sessions to change data concurrently, but your transaction will always see the latest committed state of data. So the same query can return different (more up to date) results, even during the same transaction. This is useful because it reduces the need for the database to preserve old row versions for the sake of your long-running transaction.

There are also serializable and read-uncommitted isolation levels, but these are very rarely used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top