DDC Flashcards
Transaction
Logical unit of work that completes in its entirety or not at all, with the aim of keeping the database consistent.
Dirty Read problem
when one transaction updates an item of the database,
and somehow the transaction fails, and before the data gets rollback,
the updated database item is accessed by another transaction.
Inconsistent analysis
When one user is reading values while another is updating values, resulting in a mix of old and new values being shown.
Lost update
Two transactions perform read/write operations at the same time, resulting in the second commit overriding the first
ACID properties of a transaction
Atomicity- completes in its entirety or not at all
Consistency- database must remain in a consistent state
Isolation- transactions must be executed independently of each other
Durability - changes made by transaction must persist
OLTP (Online transaction processing)
Real time access to data to either read or modify it
OLAP (Online analytical processing)
Alternative to OLTP, which involves fewer, more intense transactions
Problems with transactions
- Serially running transactions will fix this, however if only one transaction run at once then we would face a lot of problems
- Read operations can be run in parallel
- If a transaction is writing to one part of the DB, it can still access other parts unaffected by the update
Two Phase Locking
Unlocks operations only performed after all locks have been acquired.
Deadlock
two transactions waiting for each other to release a lock
Clustered index
- Controls how data is stored on a disk.
- As rows can only be stored in one order, there can only be one clustered disk per table.
Non clustered index
They contain the pointer to the row itself, the pointer is aka the row locator