Database Management System Choices Introduction To Database Systems CSE 373 Spring 2013
Outline Introduction PostgreSQL MySQL Microsoft SQL Server Choosing A DBMS NoSQL
Introduction There a lot of options for database management systems (DBMS) Popular choices include: MySQL PostgreSQL Oracle Microsoft SQL Server IBM DB2 Teradata Start by looking at PostgreSQL and continue on to some other popular choices
PostgreSQL
PostgreSQL Pronounced post-gres-q-l but often shortened to post-gres Free and open source Free as in beer and free as in speech PostgreSQL is fully ACID compliant Atomicity, Consistency, Isolation, Durability Uses SQL for querying Most of the SQL : 2008 standard is implemented PostgreSQL is seen as more standard compliant than most choices
PostgreSQL PostgreSQL is generally viewed as a powerful database Why? A lot of built-in data types such as Boolean, Circles, Lines, IPv4, IPv6 and more Less forcing data into a datatype such as Booleans into Integers or Characters Numerous built-in procedures Including math operations, string operations, and cryptography Built-in support for full text searches Stronger querying on views Can use foreign data wrappers to allow external data sources to be treated as if they were internal to the database Files, other databases, etc.. Generally, a wide range of features
PostgreSQL A very big reason for PostgreSQL s reputation for power is its language support PostgreSQL has built-in support for writing procedures with C/C++ PL/pgSQL PostgreSQL specific language that is similar to Oracle s PL/SQL Tcl Perl Python Non built-in support for a lot of other popular languages Java PHP R Scheme
PostgreSQL PostgreSQL is technically an object-relational DBMS So is Oracle In addition to the standard relational model there is also an object oriented model Direct support for objects, classes, methods and inheritance The object oriented model allows custom datatypes Leads to some very nice simplifications such as the datatype of a column being an array or a dictionary Also supports table inheritance Consider storing cities and the ability to find state capitals
PostgreSQL Using the language support and the object oriented features of PostgreSQL developers can write their own libraries These libraries allow reusable extensions to PostgreSQL s functionality There are a lot of existing libraries that are publically available that extend PostgreSQL s functionality to accomplish specific tasks Referred to as Contrib modules Such as better cryptography, better administration, key/value store support, benchmarking and a lot more
PostgreSQL PostgreSQL also has very strong support for transactional DDL DDL(data definition language) are the commands that allow a developer to perform actions such as building the database schema or migrating data Transactional DDL allows you to roll back the database to a previous state in order to fix errors during schema changes or migrations
PostgreSQL This support for transactional DDL leads to another area where PostgreSQL is perceived to as excelling at, this area is better data integrity and consistency This perception is also aided by PostgreSQL s strictness with constraints Other database systems are not as strict E.g. Inserting 1000 into a 2 digit number field will round to 99 in some databases, PostgreSQL will throw an error E.g. In other databases, a non-null date field can accept a nonsense date such as 00/00/0000, again PostgreSQL will throw an error
MySQL
MySQL Pronounced as My-s-q-l MySQL is the most popular DBMS available Popularized through the use of the LAMP stack for web applications Linux, Apache, MySQL, PHP MySQL is perceived as being as a less powerful database system with fewer features but easier to use and with better performance Seen as unable to do as much as PostgreSQL or Oracle Supports SQL : 1999 with some extra extensions A relational DBMS, not an object-relational DBMS No classes, no objects, no inheritance
MySQL One feature that sets MySQL apart in the area of performance is its support for changing the storage engine A database s storage engine handles creation, storage, and retrieval of the tables and data in the database This ability to change the storage engine allows changes to how data is stored or retrieved in order to improve performance or other measures Some examples of the supported engines MyIASM The default engine, InnoDB ACID compliant and more of a focus on recoverability Memory Stores all data in RAM for very fast accesses CSV Stores data in CSV (comma separate value) files for portability and easy exchange
MySQL MySQL has a reputation for having a number of gotchas Gotchas are unexpected behavior for statements or features that are present in other systems MySQL has pretty strong support for backwards compatibility but this can also cause gotchas to be preserved over time E.g. enums can only contain character values but can be defined to hold integers E.g. Cannot default a date column as the result of the NOW() function E.g. Dividing by zero doesn t cause an error but returns a NULL
MySQL MySQL was originally released as open source and free Free as in beer and free as in speech Oracle Corp. obtained the rights to MySQL in 2010 and this caused some controversy After version 2, Oracle changed the licensing for MySQL to a proprietary license Oracle has made several moves to monetize MySQL by requiring payment for some versions and some features In response, some developers forked MySQL and founded MariaDB which is designed to be a drop-in replacement for MySQL
Microsoft SQL Server
Microsoft SQL Server SQL Server is Microsoft s DBMS Closed source and generally, pretty expensive (several thousand dollars) Express edition is available for free to learn and experiment on but has a limited license Relational (not object-relational) database but still has a wide range of features Including built-in full text search, transactional DDL and a lot more Is more focused on competing with Oracle than MySQL and PostgreSQL Focused on large businesses and large databases In my experience has some very nice tools
Choosing A DBMS
Choosing A DBMS Choosing a database has more to do more with non-core features Core features are concerned with storage, retrieval, and other features you immediately think of when thinking of a database Certain requirements such as the ability to retrieve previous versions of a table may drive you to choosing a specific DBMS over another due to a feature that eases fulfilling that requirement Your experience with and preferences for databases will also play a role in database choice
NoSQL
NoSQL NoSQL is a recent topic that has gotten a lot of attention Name comes from not all of these systems using SQL Sometimes referenced as meaning Not Only SQL NoSQL databases are more lightweight that conventional RDMS The general focus of NoSQL systems are on improved scalability and availability at the cost of looser consistency Very popular for systems dealing with a lot of data Most NoSQL systems (but not all) do not deal with tables Graph databases, databases that store documents and key-value stores
NoSQL Example of NoSQL systems include BigTable Table based system Developed and used by Google MongoDB Stores JSON (Javascript Object Notation) like documents Used by Craigslist, foursquare, MTV and other Neo4j Graph database Dynamo Key/Value store system Developed and used by Amazon Redis An in-memory, key/value store system Used by Blizzard, Stack Overflow, GitHub, flicker
Questions?