Difference between revisions of "Databases"
Jump to navigation
Jump to search
| Line 4: | Line 4: | ||
# 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 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 | # Provide isolation between programs accessing a database concurrently | ||
| − | Generally, any change or | + | Generally, any change--threatened or actual--in a database is a transaction. Other types |
| + | |||
;ACID | ;ACID | ||
| Line 12: | Line 13: | ||
* Isolation: must not affect other transactions | * Isolation: must not affect other transactions | ||
* Durable: must be written to persistent storage | * Durable: must be written to persistent storage | ||
| + | |||
;CAP Theorem | ;CAP Theorem | ||
| Line 18: | Line 20: | ||
# 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 | ||
| + | |||
| + | ===RDBMS=== | ||
| + | In 2020, the five most popular database systems were MySQL, PostgreSQL, Microsoft SQL Server, SQLite, and MongoDB (NoSQL). (Here's a list from Wikipedia of databases that [https://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems no one has ever heard of.]) | ||
| + | ;MySQL began in 1995 using IBM's ISAM (indexed sequential access method) engine. In ISAM one uses an API directly to search indices to find records in files, whereas a relational database uses a query optimizer to select indices automatically. Cutting edge products like dBase and Microsoft Access still use it. MySQL's alternative offering is now (in addition to MyISAM). InnoDB has been the default engine since 2010 (v5.5.5) | ||
Revision as of 23:11, 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:
- 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--threatened or actual--in a database is a transaction. Other types
- 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
- Consistency: Every read receives the most recent write, or an error
- 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
RDBMS
In 2020, the five most popular database systems were MySQL, PostgreSQL, Microsoft SQL Server, SQLite, and MongoDB (NoSQL). (Here's a list from Wikipedia of databases that no one has ever heard of.)
- MySQL began in 1995 using IBM's ISAM (indexed sequential access method) engine. In ISAM one uses an API directly to search indices to find records in files, whereas a relational database uses a query optimizer to select indices automatically. Cutting edge products like dBase and Microsoft Access still use it. MySQL's alternative offering is now (in addition to MyISAM). InnoDB has been the default engine since 2010 (v5.5.5)