When you're looking for a reliable managed database solution, which should you pick?
How are managed PostgreSQL and MySQL different?
PostgreSQL and MySQL are very similar in the uses they are put to--well, they’re relational databases, you can’t really use MySQL as a coat rack (although it can make toast). That said, we can dig out some differences.
- Languages and data types
- User interfaces
- Data security and authentication
One big limitation on your freedom of choice is applications that expect to find a particular database. Flask, for example, likes PostgreSQL, so you’re better off using that. Conversely, Drupal goes well with MySQL. (That being said, both have community-driven extensions that allow other databases.)
Of the two, PostgreSQL comes closer to full SQL:2016 Core conformance. PostgreSQL 12 supports 160 of the 179 required features. MySQL, on the other hand, strays further from the fold with only 54 supported features.
Both PostgreSQL and MySQL are ACID compliant (atomicity, consistency, isolation, durability): transactions are protected and queries maintain data integrity. With MySQL, this requires using InnoDB.
Languages and data types
Common wisdom holds that where MySQL is lithe and quick, PostgreSQL is full-featured and versatile. This would make MySQL more suited to heavy loads performing straightforward tasks, and PostgreSQL a better fit for complex use cases.
While kind of true, this picture is a little simplistic.
PostgreSQL focuses heavily on performance improvements in its development. PostgreSQL 13 alone listed 12 performance-enhancing changes, continuing a trend from PostgreSQL 12. At the same time, MySQL’s extensive community actively develops new features. However, increased complexity presents performance challenges. So there’s less of a difference now than once there was.
MySQL has MySQL Workbench; you can also use it for PostgreSQL, or opt for e.g. pgAdmin or SQL Workbench.
Aiven offers a comprehensive list of extensions for PostgreSQL. These include TimescaleDB, which, when used as a PostgreSQL extension, gives you access to features developed for time series data without having to move over to a full-blown TSDB. Then there’s PostGIS, which adds location data features by supporting geographic objects.
But there are loads more. Check out the full list of PostgreSQL extensions at Aiven in our Help article!
Data security and authentication
MySQL implements user management with roles and privileges. For authentication, you can use Linux PAM, LDAP, and native Windows services.
Similarly, PostgreSQL has robust user and group management, but it also includes a pluggable config file. It supports PAM and Kerberos.
SSL is used in PostgreSQL, but not in the more weakly-encrypted MySQL.
Coding with PostgreSQL or MySQL is slightly different. MySQL is not case sensitive, and happily eats IF and IFNULL statements. It also requires UTF-8 input, though, which PostgreSQL will not accept. PostgreSQL won't like your IFs and IFNULLs, either (you have to use CASE statements instead).
MySQL has a larger community, so when you get in trouble you can count on more robust support; at least as far as your peer group goes. However, it can be argued that PostgreSQL, as the more standards-conformant and robust system, doesn’t require as much support… And it also has a dedicated community.
(Besides--if you come to Aiven, we’ll give you bonus cookies, in the form of 24/7 expert support. Just saying.)
Wrapping up: when to use which
For developers in need of a rich feature set and admins requiring protected, fault-tolerant environments, PostgreSQL is a good choice. It’s a little complex to set up and manage, but if you get it fully managed from Aiven, neither of those issues will be a headache.
For those needing a fast, lightweight, proven database solution that’s customizable with a little work, MySQL could be the right companion. It also has a vibrant community to answer any questions you may have. Then again, get it managed from Aiven and we can certainly answer those questions for you.
If you're not using Aiven services yet, go ahead and sign up now for your free trial at https://console.aiven.io/signup!
Nov 16, 2021
Announcing Aiven for PostgreSQL® 14.0
We have upgraded to the latest PostgreSQL version. And it's great! Read on to find out what changes for you and what you need to do.
Feb 26, 2021
Aiven for PostgreSQL® for your Go application
Applications and databases go together like milk and cookies; on the menu today, a PostgreSQL cookie with a splash of refreshing Go milk. Bon appetit!
Jun 22, 2021
Introducing Aiven for PostgreSQL® change data capture
(Updated) How does PostgreSQL capture changes in data? Read this post for a look at the methods available.
Auri & Francesco & John
Subscribe to the Aiven newsletter
All things open source, plus our product updates and news in a monthly newsletter.