Technical analysis of the difference between Mysql and Postgresql

Subscribe to my newsletter and never miss my upcoming articles

What is Mysql? firsly Mysql is pronounce MY-ES-KYOO-EL’ [maɪˌɛsˌkjuːˈɛl]. often time some people still call it “my sequel”. Mysql was originally developed by a swedish company called MYSQL AB in 1994. in 2008 a US tech company called Sun microsystems bought MYSQL AB and took ownership of MYSQL by 2010 US tech giant Oracle acquired Sun Microsystems itself, and MySQL has been practically owned by Oracle since.

Mysql is an open source relational database management system (RDBMS) with a client-server model. RDBMS is a software or service used to create and manage databases based on a relational model. It is most noted for its quick processing, proven reliability, ease and flexibility of use. MySQL runs on virtually all platforms, including Linux, UNIX and Windows.

PostgreSQL (initially called Postgres) was created by a computer science professor Michael Stonebraker and his team. Today it has become one of the popular open-source databases.

PostgreSQL is an enterprise-class open source database management system. It supports both SQL for relational and JSON for non-relational queries. It is backed by an experienced community of developers who have made tremendous contribution to make it highly reliable DBMS system.

PostgreSQL supports advanced data types and advance performance optimization, features only available in the expensive commercial database, like Oracle and SQL Server.

Why use MySQL?

  • Supports features like Master-Slave Replication, Scale-Out
  • It supports Offload Reporting, Geographic Data Distribution, etc.
  • Very Low overhead with MyISAM storage engine when used for read-mostly applications
  • Support for Memory storage engine for frequently used tables
  • Query Cache for repeatedly used statements
  • You can easily learn and troubleshoot MySQL from different sources like blogs, white papers, and books

Why use PostgreSQL?

  • Offers useful features like Table partitioning, Point in Time Recovery, Transactional DDL, etc.
  • Ability to utilize 3rd party Key Stores in a full PKI infrastructure
  • Developers can modify open source code as it is licensed under BSD without the need to contribute back enhancements
  • Independent Software Vendors can redistribute it without the fear of being "infected" by an open source license
  • Users and Roles can be assigned Object level privileges
  • Supports AES, 3DES and other data encryption algorithm

FEATURES

Untitled.png

Postgres Advantages over MySQL Postgres is an object-relational database, while MySQL is a purely relational database. This means that Postgres includes features like table inheritance and function overloading, which can be important to certain applications. Postgres also adheres more closely to SQL standards.

Postgres handles concurrency better than MySQL for multiple reasons:

Postgres implements Multiversion Concurrency Control (MVCC) without read locks Postgres supports parallel query plans that can use multiple CPUs/cores Postgres can create indexes in a non-blocking way (through the CREATE INDEX CONCURRENTLY syntax), and it can create partial indexes (for example, if you have a model with soft deletes, you can create an index that ignores records marked as deleted) Postgres is known for protecting data integrity at the transaction level. This makes it less vulnerable to data corruption

20200630_163130.png

Conclusion Comparing both, we can say that MySQL has done a great job of improving itself to stay relevant, but on the other side for PostgreSQL, you don't need any licensing. It also offers table inheritance, rules systems, custom data types, and database events. So, it certainly edges above MySQL.

Comments (1)

Francisco Quintero's photo

Nice comparison. Didn't know about Postgres being object-relational and that being an important difference.

I add that, IMO, the MySQL console is easier to get along with than the Postgres one 😅