Linux Programming Security Web

PostgreSQL vs MySQL performance. How to choose.

PostgreSQL vs MySQL
PostgreSQL vs MySQL

Here we tried to list out all the possible things you should consider when choosing between PostgreSQL vs MySQL for a given application or given sets of requirements. We layed-out the pointers how they differ from each other and how to choose one over the other.

PostgreSQL vs MYSQL

PostgreSQL is probably the biggest open source competitor to MySQL and for good reasons. It’s a great enterprise quality SQL solution. On the other hand MySQL is managed by Oracle and has extensive scope for applications. This article is technical comparison between PostgreSQL vs MYSQL performance.

SQL Compliance

PostgreSQL really is SQL compliant unlike MySQL. PostgreSQL better implements a lot of the things that oracle does in an open source environment even though MySQL is owned by oracle. If you really have to choose running between PostgreSQL vs MySQL for a new development project. It is really about whether or not at some point of time you’re going to run a closed source better supported option like oracle. PostgreSQL is SQL compliant therefore any code that you write for PostgreSQL will port very easily to oracle. MySQL has diverted from the SQL standards. Now there are many variances in the way certain queries run on both systems.

ACID Compliance

In terms of reliability, PostgreSQL is a better choice because it’s ACID Compliance. ACID is a standard for whether or not your data integrity is going to be held across all type of queries and it is robust enough to always return the same results without faults. MySQL is not ACID certified so it doesn’t do all of these things that PostgreSQL does. Part of that relates to, how does it do auditing and transaction handling.

Development Perspective

If you are doing new development we really suggest that you go with PostgreSQL. If you are trying to run somebody else’s software that was written for MySQL then PostgreSQL really isn’t an option. There are some exception, there is a PostgreSQL plugin for WordPress. But there are not so many extensions, if you are trying to run other LAMP stack applications. PostgreSQL is also a great choice if you are planning to upgrade to oracle later on. MySQL can be a good choice if you think you are going to borrow code from other open source projects.

Database Performance

In the past, MySQL was a first choice of developers for read-heavy workloads, even at the cost of concurrency when mixed with write operations. PostgreSQL projects itself as “the most advanced open-source relational database in the world”. It was built to be feature-rich, extendable and standards-compliant. Previously, PostgreSQL’s running performance was really balanced – read operations were generally slower than MySQL, but it has the capacity of writing large amounts of data more efficiently when hardware resources are compared to MySQL and it always handled concurrency better. The performance gap between MySQL and PostgreSQL have been largely cleared in recent releases. Even today MySQL is still very fast at reading data, but only if using the old MyISAM engine. If using InnoDB (which allows transactions, key constraints, and other important features), differences are not considerable (if they even exist). These functionalities are essential for enterprise or consumer-scale applications, so using the outdated engine is really not an option. On the other hand, in recent years PostgreSQL has also been optimized to erase the differences when it comes to heavy data writes.

Concurrency Support

Concurrency in DBMS systems means that more then one users can access the same data at the same time. PostgreSQL provides concurrency very efficiently with its MVCC implementation, which attains very high levels of concurrency even in large data sets. MySQL only has MVCC support in InnoDB. MySQL does not has MVCC suppoot in MyISAM .

Community Support

MySQL has a large community of developers who are constantly maintaining current code-base with new features emerging occasionally.

In case of PostgreSQL, active community also constantly improves its existing features while its innovative developers strives to ensure it remains the most advanced database. New features for PostgreSQL are always being tested and security enhancements are regularly released.

Cloud and Hosting

MySQL and PostgreSQL both are Supported by all the prominent cloud service providers, including Amazon, Google, and Microsoft. MySQL is still used a lot in shared hosting environments. Default MySQL package has also been replaced by MariaDB in Debian software repositories as it gets no updates.


About the author

Ajay Verma

A Computer Science Graduate, who works extensively on open source projects. His Areas Of interest are: Network Security, Linux Administration, FOSS, Python, and C programming.

Add Comment

Click here to post a comment