Resources
2 min read
Last updated:
Choosing whether to go with PostgreSQL or MySQL depends on your needs as they are both great databases to use under different circumstances.
In this article we will run through a few of the top reasons and use cases to help you choose between these choices for database creation.
Contents
Advantages of MySQL:
-
Simple programming syntax. MySQL uses a simple SQL syntax making it easier for novice developers. Coupled with the fact that it is not only open-source but also free to use, MySQL is the most popular database of the two.
Note: As a matter of fact, MySQL is so popular it became part of the LAMP stack (Linux, Apache, MySQL, PHP) used for building many web servers.
-
High Performance especially with a high-volume of read requests making it perfect for some web applications (Airbnb is a good example of MySQL being used in this way).
-
Security - many security features have been built into MySQL making it a very secure option.
-
Faster than comparable databases
-
Built for scalability
-
Feature rich
For those wanting an easy to use, secure, high performing relational database, MySQL is an ideal choice. So where does that leave PostgreSQL?
If MySQL is the most popular database, Postgres would be the most advanced one. With an active and strong community, Postgres might not be the most popular but it is the most extensible and feature-rich.
Advantages of Postgres:
- SQL compliance. PostgreSQL offers more SQL features such as INTERSECT and more advanced data types like arrays.
- High performance for complex queries and high read and write requests (making it perfect for e-commerce applications).
- ACID compliance (MySQL offers ACID compliance on some of their storage engines but not all).
- Strong community & third party support
Additional Use Cases & Their Relevance For PostgreSQL Vs MySQL Comparison
CTO Dusten Salinas gave some additional thoughts around particular use cases where the different strengths of these relational databases was worth noting;
“When evaluating data storage, the decision must be made based upon the project's nature and need. This then will emphasize the strengths and weaknesses of each database.”
“A startup, for example, that wants to rapidly-produce a customer-facing app likely would wish to focus upon ease of use, speed, and familiarity. This lends itself to MySQL due to out of the box performance and reliability, good feature set, and a large percentage of DbAs and developers are also familiar with this. MySQL also has better capabilities for scalability which ensure that the database grows with you through extensibility.”
“If, however, the project was a HIPAA compliant data analysis enterprise solution, then the paradigm shifts. Postgres's proven feature set, including data analysis tools, would make this the primary choice most suitable for this use case.
“In addition to this, SQlite’s strengths lie in its portability. It is a favourable choice if the data store needs to be embedded or you're in an isolated test environment, however, outside of particular niche use cases, SQlite should quickly be pruned in the decision-making process for the majority of projects.”
As mentioned previously, choosing between Postgres vs MySQL depends on your needs. If you have a web application with simple data transactions, then follow Facebook or Twitter's example and choose MySQL. For more features, follow what Instagram and Apple did and go with PostgreSQL.
If you enjoyed this article comparing MySQL vs PostgreSQL then why not read our previous article on Microservices vs APIs?