Difference between revisions of "Databases"

From Bitnami MediaWiki
Jump to navigation Jump to search
(Created page with "===Background and Invention=== ;What The Fuck is a Transaction? A '''database transaction''' is a unit of work done within a DBMS against a database, and treated independentl...")
 
Line 2: Line 2:
 
;What The Fuck is a Transaction?  
 
;What The Fuck is a Transaction?  
 
A '''database transaction''' is a unit of work done within a DBMS against a database, and treated independently from other transactions. They serve two purposes:
 
A '''database transaction''' is a unit of work done within a DBMS against a database, and treated independently from other transactions. They serve two purposes:
−
::#  
+
::# Provide reliable units of work that permit failure recovery and maintain database consistency even under system failure, if execution stops and leaves multiple operations uncompleted
−
::#  
+
::# Provide isolation between programs accessing a database concurrently
−
 
+
Generally, any change or potential change in a database is a transaction.  
−
Generally, any change in a database.  
 
  
 +
;ACID
 +
Transactions must follow the ACID paradigm:
 +
* Atomicity: must be atomic, that is complete in its entirety or have no effect
 +
* Consistency: must conform to existing constraints in the database
 +
* Isolation: must not affect other transactions
 +
* Durable: must be written to persistent storage
  
 
;CAP Theorem
 
;CAP Theorem
Line 13: Line 18:
 
# Availability: Every request receives a (non-error) response, without the guarantee it contains the most recent write
 
# Availability: Every request receives a (non-error) response, without the guarantee it contains the most recent write
 
# Partition tolerance: The system continues to operate despite an arbitrary number of messages being dropped by the network between nodes
 
# Partition tolerance: The system continues to operate despite an arbitrary number of messages being dropped by the network between nodes
−
 
−
;ACID
 
−
* Atomicity:
 

Revision as of 22:29, 17 February 2021

Background and Invention

What The Fuck is a Transaction?

A database transaction is a unit of work done within a DBMS against a database, and treated independently from other transactions. They serve two purposes:

  1. Provide reliable units of work that permit failure recovery and maintain database consistency even under system failure, if execution stops and leaves multiple operations uncompleted
  2. Provide isolation between programs accessing a database concurrently

Generally, any change or potential change in a database is a transaction.

ACID

Transactions must follow the ACID paradigm:

  • Atomicity: must be atomic, that is complete in its entirety or have no effect
  • Consistency: must conform to existing constraints in the database
  • Isolation: must not affect other transactions
  • Durable: must be written to persistent storage
CAP Theorem

Only two of the following three can be guaranteed for a distributed data store

  1. Consistency: Every read receives the most recent write, or an error
  2. Availability: Every request receives a (non-error) response, without the guarantee it contains the most recent write
  3. Partition tolerance: The system continues to operate despite an arbitrary number of messages being dropped by the network between nodes