SQLite vs PostgreSQL

Michael Causey
2 min readMar 22, 2021

Two of the most popular relational database management systems are known as SQLite and PostgreSQL. While both serve similar functions, namely managing SQL databases, there are a couple differences between the two that should be noted before deciding which to use. This piece will explore some of these differences.

Servers

One of the first differences we’ll explore is how each of these work with our apps. SQLite, to start, is known as an “embedded” database, which means it runs within our app, and does not need an external server in order to run. PostgreSQL, on the other hand, requires its own database server, and works on a client-server design and runs over a network.

Ease of Setup and Speed

SQLite is considered relatively easier to setup, due to its simpler design. Further, it acts as the default database when creating new Ruby on Rails applications. To use PostgreSQL, changes must be made to the app (such as downloading and configuration of Postgres) before the database it created. Due to the complexity of PostgreSQL, this process can be difficult for some, especially novice or first-time users.

The speed of each of these does vary. For simple processes, SQLite does act fast, again due to its minimal design. For those same simple processes on PostgreSQL, the complexity of its design may over-run its intention, and it would appear slower. However, with more complex processes, PostgreSQL far outpaces SQLite, as this is more in the wheelhouse of PostgreSQL’s design.

Access and Security

These areas come up more as different projects scale. Currently, SQLite does not have any user management systems in place, nor does it have any authentication processes. Anyone has access to the database, and can read or edit any piece of the data. In comparison, PostgreSQL can handle multiple users, and can assign each user differing levels of permissions. Further, PostgreSQL has many configurations to keep the data within the database safe and unchanged unless intended,

The Data

One of the more important thing to keep in mind when choosing between these two is the type of data you will be storing in your database. SQLite can only handle five types of data: blob, null, real, text, and integer types. Meanwhile, PostgreSQL can handle seemingly any data types that can be stored.

Conclusion

As a still somewhat novice to intermediate developer myself, I have yet to build anything on my own which requires the size and complexity of PostgreSQL, though I will admit I have experimented some in an effort to continue learning. For the large majority of my personal projects (mostly standalone apps or simple websites), if a database is needed, I use SQLite, because of the earlier mentioned default of Ruby on Rails and the simplicity of use. However, in more complex and professional settings, where the database can be large and unwieldy, the clear choice would be a system like PostgreSQL, because of the intricate nature of the code bases.

--

--

Michael Causey

Flatiron School DC. Learning to code one day at a time.