Difference between revisions of "Databases"

From Bitnami MediaWiki
Jump to navigation Jump to search
Line 23: Line 23:
 
===RDBMS===
 
===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.])  
 
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)
+
* 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). Neither ISAM nor MyISAM is ''transactional''. InnoDB became default in MySQL 8.0 and [https://dev.mysql.com/doc/refman/8.0/en/innodb-introduction.html here] are the details.
 +
* PostgreSQL dates back to the 80s at UC Berkeley but was born in 1996. It features ACID transactions and views, materialized views, triggers, foreign keys and stored procedures. MVCC (multi-version concurrency control) eliminates the need for read-locks and ensures ACID. It supports full serializability. Supports B-tree and hash table indices as well as generalized search trees (GiST), generalized inverted indices (GIN), space-partitioned GiST, and block range indices (BRIN). This variety of indexing facilitates things like the PostGIS project which stores geographic information.

Revision as of 23:32, 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--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

  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

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). Neither ISAM nor MyISAM is transactional. InnoDB became default in MySQL 8.0 and here are the details.
  • PostgreSQL dates back to the 80s at UC Berkeley but was born in 1996. It features ACID transactions and views, materialized views, triggers, foreign keys and stored procedures. MVCC (multi-version concurrency control) eliminates the need for read-locks and ensures ACID. It supports full serializability. Supports B-tree and hash table indices as well as generalized search trees (GiST), generalized inverted indices (GIN), space-partitioned GiST, and block range indices (BRIN). This variety of indexing facilitates things like the PostGIS project which stores geographic information.