Introduction, Transactions, Concurrency Control and Recovery Flashcards
What are database transactions
query
update
transaction
What is a query?
a query is a request to the DBMS to retrieve data from the database
What is a update?
an update requests the DBMS to insert, delete or modify existing data
What is a transaction?
a transaction is a unit of work performed against a database, and treated in a coherent and reliable way independent of other transactions.
transactions are logical groupings of query and update requests to perform a task
Transactions management only applies to the DML. why?
this encompasses the four basic functions of persistent storage, create, read, update and delete (CRUD)
FACTS about transactions
each SQL command run is treated as a transaction
How do you define a multi step transaction
START TRANSACTION or BEGIN starts a new transaction
COMMIT to commit (Save) the current transaction making its changes permanent
usually used to ensure;
complex data integrity
transaction states are?
two outcomes;
SUCCESS
FAILURE
Describe Failure
transaction aborts, and database must be resorted to consistent state before it started. such a transaction is rolled back or undone.
Describe Success
transaction commits and database reaches a new consistent state
a committed transaction cannot be ABORTED!
Transaction managers are components of a DBMS.
describe the two main purposes.
- to provide reliable units of work
2. to provide isolation between programs accessing a database concurrently.
to ensure these goals, DB transactions must be:
atomic
consistent
isolated
durable
Explain atomicity
either all the operations associated with a transaction happen or none of them happen
Explain consistency
a transaction must transform the database from one consistent state to another, ensuring all predefined rules are adhered to
e.g. foreign keys
Explain Isolation
the result of the execution of concurrent
transactions is the same as if transactions were executed serially