Earlier quoted context omitted.
To implement the serializable isolation level, the database system must track access to every single row you access, even the ones you read or filter out. (The need to track reads, even for rows filtered out of a select statement is surprising but necessary.) Consider a common scenario where you SELECT a set of rows and take a SUM over a column. Suppose your query and another query begin reading from the same committ…
> The only way for the database system to guarantee there is no conflict is to keep track of every single row your query accesses, even if it is a row passed over by a WHERE clause! Why is putting a lock on the table itself not an option?
Demystifying Database Systems: An Introduction to Transaction Isolation Levels
21–23 of 23 posts
Re: Demystifying Database Systems: An Introduction to Transaction Isolation Levels
#22Earlier quoted context omitted.
As mentioned in the post: "There are several ways to achieve [serializability] — such as via locking, validation, or multi-versioning." Deadlock happens under some, but not all implementations of serializability via locking. There have been several database systems developed in my lab that use locking to achieve serializability, but yet never deadlock. Examples include: (1) Calvin: http://www.cs.umd.edu/~abadi/papers…
What I'm talking about here is not academic database technologies in laboratories, but the typical mysql/postgres/oracle/sqlserver production world regular programmers live in. So yes, I know pragmatic strategies for avoiding deadlocks, but in all the databases I've used, you have to proactively employ such a strategy. Many if not most of these programmers have at best a rudimentary knowledge of transactions and/or w…
Re: Demystifying Database Systems: An Introduction to Transaction Isolation Levels
#23In many real world applications using common databases you do not always need “transaction safety”, in particular when reading data for statistical purposes. Performance gains and not blocking the database for many other readers and writers will in many scenarios outweigh the possibly of reading uncommitted/dirty data. Use: SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED (whether you are are querying from within a t…