Should I use SQLite, PostgreSQL, or MySQL?

Written by Dan Parry.

Database Management Systems (DBMS), in short, are collections of tools used to access and manipulate the data stored in a database. There are lots of different types of DB management systems but the most widely used are Relational Database Management Systems (RDBMSs).

RDBMSs use the relational model to store data in the form of tables (referred to as relations). Each relation is then further organized into rows (tuples) and columns (attributes). A relation is managed and/or queried using Structured Query Language (SQL).

There are many dialects of SQL, the three most popular of which are SQLite, PostgreSQL, and MySQL. Each has its own limitations and use cases, so let’s take a look at when to use each to see which one might be the best fit for your next project.

Let’s start with a look at by far the most popular of the three — MySQL. Used by Google, Linkedin, Amazon, Netflix, and Twitter, it is an easily accessible, high-performing system that is most commonly used for web-based applications.

MySQL is built into major content management systems like WordPress, so you can’t go far online without finding something that is supported by it.

Written in C and C++ and ACID compliant, MySQL is commonly used for enterprise applications thanks to its scalability, replication, and security features. It’s also the go-to system if speed is a requirement for your application because the exclusion of some more advanced features MySQL is lightweight while still delivering high performance.

MySQL’s popularity also means it has the best resources to take advantage of. It’s part of the Oracle ecosystem so if you’re looking for support you’ll have no trouble finding tools for management, monitoring, and learning.

Overall MySQL provides a reliable DB solution that’s simple to set up and requires minimal developer input. This, along with its great toolset and multi-user feature support, makes it the most accessible option out there.

When to use MySQL:

  • Websites and Web-based applications — MySQL’s easy setup, huge support community, and robust security features make it a great choice for most websites and applications.
  • When speed is a requirement — At the expense of some more advanced features you might find in PostgreSQL, MySQL is able to optimize speed.
  • Distributed operations — thanks to its replication support MySQL is the best choice for distributed database setups.
  • For predicted scaling and growth — Thanks again to that wonderful replication support, it is easy to implement horizontal scaling on MySQL, so if your website is expected to take off, MySQL is your best choice.

PostgreSQL is an open-source object RDBMS that is typically used in more complex websites and applications that require a customizable DB solution. PostgreSQL is ACID-compliant and is used by companies such as Apple and Cisco. Like MySQL, PostgreSQL also offers features such as security and replication.

PostgreSQL is known for supporting a lot of data types and having deep functionality, but this comes at the cost of a more intensive setup than MySQL. It’s more popular in teams that already have dedicated DB specialists as they can create and implement custom PostgreSQL functions in a variety of languages like C, C++, and Java.

PostgreSQL is the go-to solution for complex analytical processes. It does, however, take a more specialist toolset to manage and due to its highly customizable nature, it can be harder to find support resources than MySQL. There may not always be a solution available for your specific issue in the forums and documentation but there are paid third-party setup services available, making it a viable solution for companies with specialized DB needs to have their system set up and their team trained.

When to use PostgreSQL:

  • For complex queries and operations — PostgreSQL’s ability to support multiple concurrent writers and query plans that can make use of multiple CPUs make it the clear choice for complex tasks.
  • When customizability is needed — An extensive amount of customizability gives you far more control over MySQL when it comes to database setup.
  • Data Warehousing — Due to its ability to read/write at fast speeds, PostgreSQL is perfect for data analysis applications.

SQLite is a server-less and self-contained database that does not require any setup or installation to get started. Also known as an embedded database, SQLite runs as part of the app itself instead of part of a separate server process.

SQLite is the most compact and easy-to-use entry of the three and is also ACID adherent. While it is a great out the box solution for low to medium traffic websites, its lack of versatility and feature set found in its more complete counterparts give it some major disadvantages.

SQLite is best implemented in embedded software — anything that only requires a small amount of data to be saved or even websites with the south of 100k visitors a day.

When to use SQLite:

  • Embedded applications — when you want to save a small amount of data, systems like a telephone, fitness tracker, or air conditioning system would be a great time to use SQLite.
  • Low traffic website — SQLite isn’t the best choice for huge amounts of data or users, but for small operations, the no-setup and config requirements make SQLite the way to go.
  • Testing — A great lightweight alternative to fast testing without the need to implement an actual database.

Horses for courses

Looking at all three libraries it’s clear that while they all have pros and cons, a direct comparison doesn’t make sense, they all fill a specific need. MySQL with its great feature set, community support, and easy setup, is the best allrounder for most web-based applications. PostgreSQL is the way to go for high customizability and specific database requirements, and SQLite is the best option for an application with low DB storage needs or a website with low traffic.

It’s different horses for different courses, but here are some bonus rounds to help you a clearer picture:


All three options are open-source so they are completely free to implement!

Data Queries

MySQL — Is more resource-efficient because it offers a scalable buffer pool to pull cache.

PostgreSQL — is more organized because it isolates processes by treating them as a separate OS process.

Temporary tables

PostgreSQL — offers a lot more functionality than MySQL. Tables can be divided into local and global to be configured with flexible variables. If you’re developing an application with a lot of complex processes, this is the choice for you.

Memory-Optimized tables
MySQL — Memory-optimized tables are basically the native approach of MySQL is the best option and a great way to save resources.


Open source solutions like the ones we’ve looked at today are the best options for flexibility, cost efficiency, and innovation, but which one you use depends entirely on your needs.

MySQL is the clear option for most applications and PostgreSQL is the choice for more complex and custom projects. SQLite is your best friend for small operations and embedded systems.

At Codesphere, we are happy to announce that we just added support for setting up SQLite databases seamlessly in a project, but more on that later this week!

Happy Coding!