How do databases keep data consistent and safe during concurrent transactions?
Understand transaction processing, the ACID properties, record locking and the deadlock that can result, redundancy and database recovery.
A focused answer to AQA A-Level Computer Science 4.10.5, covering transaction processing, the ACID properties, record locking and deadlock, redundancy, and database recovery from failure.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
AQA wants you to explain transaction processing and the ACID properties, describe record locking and the deadlock it can cause, and explain redundancy and database recovery.
Transactions and ACID
The four properties matter most when many users hit the same data at once, which is the normal situation for any real database behind a website or banking system. Atomicity protects against partial completion, consistency protects the rules of the data, isolation protects against concurrent interference, and durability protects against losing committed work in a crash. Together they are what let a user trust that a confirmed transaction really happened and will not be silently undone.
Record locking and deadlock
The lost update problem is the concrete reason locking exists: without it, two transactions could both read a balance of 100, each add 50, and both write 150, losing one of the additions so the correct 200 is never reached. Locking serialises such updates so they apply one after another. The deadlock it can cause is a kind of circular waiting (the same idea as in process scheduling), and recognising that the cure is to detect the cycle and roll one transaction back is what distinguishes a complete answer.
Redundancy and recovery
The transaction log is the key to durability: because every committed change is recorded before or as it is applied, a crash cannot lose committed work, since the log can be replayed to reconstruct the database. Combined with regular backups (a form of redundancy), this lets a database recover to a consistent point even after a serious hardware failure, which is why these mechanisms underpin systems that must never lose data.
Exam-style practice questions
Practice questions written in the style of AQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
AQA 20194 marksA bank transfer debits 100 pounds from one account and credits it to another. Using this example, explain the atomicity and consistency properties of a transaction.Show worked answer →
Atomicity means the transaction is all or nothing. The transfer has two parts, the debit and the credit; atomicity guarantees that either both happen or neither does. If the system failed after the debit but before the credit, the whole transaction would be rolled back so the money is not lost, leaving the accounts as they were before.
Consistency means the transaction takes the database from one valid state to another. Before and after the transfer the total money across the two accounts is unchanged and all rules (such as no impossible balances) still hold; the transaction never leaves the database in an invalid state where the money has been debited but not credited.
Markers reward explaining atomicity as both-or-neither with the rollback consequence, and consistency as moving between valid states with the invariant (total money preserved) maintained.
AQA 20214 marksExplain how record locking prevents the lost update problem, and describe how it can lead to deadlock and how a database system can deal with deadlock.Show worked answer →
The lost update problem occurs when two transactions read the same record and both write back changes, so one update overwrites and loses the other. Record locking prevents this by locking a record while one transaction is updating it, so a second transaction cannot change the same record until the lock is released, ensuring updates are applied one at a time.
Locking can cause deadlock when transaction A locks record 1 and then needs record 2, while transaction B has locked record 2 and needs record 1: each waits for a record the other holds, so neither can proceed. A database system deals with deadlock by detecting it (for example finding a cycle of waiting transactions) and aborting and rolling back one transaction so the other can continue, or by preventing it by requiring locks to be acquired in a fixed order.
Markers reward how locking serialises updates to prevent lost updates, the mutual-wait description of deadlock, and a valid resolution (abort and retry one, or order the locks).
Related dot points
- Understand relational databases, primary and foreign keys, the problems of data redundancy, and normalisation to first, second and third normal form.
A focused answer to AQA A-Level Computer Science 4.10.2, covering relational databases, primary and foreign keys, the problems of data redundancy, and normalisation to first, second and third normal form.
- Understand SQL for retrieving data with SELECT, FROM, WHERE and ORDER BY, joining tables, and modifying data with INSERT, UPDATE and DELETE.
A focused answer to AQA A-Level Computer Science 4.10.3 and 4.10.4, covering SQL for retrieving data with SELECT, FROM, WHERE and ORDER BY, joining tables, and modifying data with INSERT, UPDATE and DELETE.
- Understand conceptual data modelling, entities, attributes and relationships, entity relationship (ER) diagrams, and the degrees of relationship (one-to-one, one-to-many, many-to-many).
A focused answer to AQA A-Level Computer Science 4.10.1, covering conceptual data modelling, entities, attributes and relationships, entity relationship diagrams, and the degrees of relationship including resolving many-to-many.
- Understand the client-server and peer-to-peer models, web technologies including HTML, CSS and JavaScript, the role of web servers, and the use of APIs and thin versus thick clients.
A focused answer to AQA A-Level Computer Science 4.8.6, covering the client-server and peer-to-peer models, web technologies including HTML, CSS and JavaScript, the role of web servers, and thin versus thick clients.
- Understand network security threats, firewalls and proxy servers, the use of encryption, digital certificates and digital signatures, and the difference between symmetric and asymmetric encryption in transmission.
A focused answer to AQA A-Level Computer Science 4.8.5, covering network security threats, firewalls and proxy servers, encryption in transmission, digital certificates and digital signatures, and symmetric versus asymmetric encryption.
Sources & how we know this
- AQA A-level Computer Science (7517) specification — AQA (2015)