DEV Community

Cover image for Should I use SQLite, PostgreSQL, or MySQL?

Should I use SQLite, PostgreSQL, or MySQL?

Simon Pfeiffer on September 21, 2021

Written by Dan Parry. Database Management Systems (DBMS), in short, are collections of tools used to access and manipulate the data stored in a da...
Collapse
 
dewofyouryouth_43 profile image
Jacob E. Shore

Generally speaking, just use postgres, it'll be fine. There are many ways to optimize for speed but the limits of MySQL are significant and will likely eventually come to bite you.
SQLite is good for native app local storage and also I think it's really a good way to transfer data in some use cases.

Collapse
 
mtrantalainen profile image
Mikko Rantalainen

I agree that the real options are SQLite and Postgres. If you want SQL database for offline use in a single app, SQLite is the way to go. For everything else you should pick up Postgres.

The whole point of MySQL and MariaDB is backwards compatibility. New projects should not start with either.

Collapse
 
yw662 profile image
yw662

Sqlite might also be an option in some online cases. But yeah postgres is usually the way to go.

Thread Thread
 
grizzlysmit profile image
Francis Grizzly Smit

yep I agree SQLite for little in app stuff, and Postres for all the rest, but if I am forced to use the MySQl/MariaDB route then MariaDB is better, it keeps you out of clutches of Oracle

Collapse
 
buphmin profile image
buphmin

I've used both MySQL and Postgres, and somewhat prefer postgres nowadays. Though I'm not sure what you mean by "limits of MySQL are significant". In what way is it so significantly different? At my last job the I saw MySQL being used housing tens of thousands of tables, some of which having billions of records and over a petabyte of production data being used to analyze marketing metrics. Honestly just curious: what are the limits? I don't have any evidence to say what the limits to MySQL are.

Collapse
 
dewofyouryouth_43 profile image
Jacob E. Shore

Well. I won't give a comprehensive list. But list a few examples that should give you an idea of what I'm talking about. Until MySQL 8.0 there wasn't even support for any window functions. In 8.0 there's minimal support for window functions. There's no support for row level security. Upsert constraints are reduced to INSERT or REPLACE (which is dicey).

Collapse
 
peerreynders profile image
peerreynders

One other point about MySQL is that it fell into Oracle's lap with their acquisition of Sun Microsystems in 2009. Given Oracle's regular commercial shenanigans it wouldn't be too surprising if there are directives in place to ensure that MySQL never becomes a serious competitor to their own in-house RDBMS product.

Now granted there is MariaDB as a fallback if the unthinkable happens — however personally for me there is enough there to bypass MySQL entirely and go straight to PostgreSQL.

(Amazon put in a significant effort which finally in October 2019 resulted in their business shedding the last of its dependencies on Oracle — a move that had little to do with "Dogfooding").

Collapse
 
chuniversiteit profile image
Chun Fei Lung

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.

This is seen as a good thing? 🙈

Joking aside, I think Oracle has done a reasonable job maintaining MySQL. Given the choice between MySQL and MariaDB, its Oracle-free competitor, I would still choose MariaDB over MySQL though, because it’s better in almost every way.

Collapse
 
simoncodephere profile image
Simon Pfeiffer Codesphere Inc.

Interesting take, will look into MariaDB :)

Collapse
 
tadman profile image
Scott Tadman

It's astonishing how far Postgres has come since the 8.0 era, circa 2005. A lot of the arguments about it being "more complicated" and "lacking tools" are falling away as it gains more and more traction.

If you don't like Postgres enough to switch away from MySQL today, give it a few years and you'll have even more reasons.

Really love what the Postgres team has done over the last decade and a half. It's astonishing the progress they've made.

Collapse
 
yawaramin profile image
Yawar Amin

Let's start with a look at by far the most popular of the three - MySQL.

Depends how you define 'popular'. SQLite is by far the most widely-deployed RDBMS, by orders of magnitude: sqlite.org/mostdeployed.html

Collapse
 
danp20 profile image
Dan Parry Codesphere Inc.

Fine, I meant just my favorite :D

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

I think SQLite and PostgreSQL are significantly different, other than embedded vs server.

SQLite - much less feature-rich; much smaller, suitable for embedded; add functions in the driver of language of your choice

PostgreSQL - more features; write functions into SQL, or that can compile for Postgres; comply to 12-factor app

Some time ago, I was also recommended firebird; but I dropped it, because of no full text search (FTS) support.

If I remembered correctly, at least Firebird, Neo4j and CouchDB have this dual nature.

Collapse
 
jrioscloud profile image
Jaime Rios

Great article. Thanks for sharing.

Collapse
 
simoncodephere profile image
Simon Pfeiffer Codesphere Inc.

Thanks! Glad to hear that

Collapse
 
hesamrad profile image
Hesam Rad

Informative article. Thanks for putting the time to write it.

Collapse
 
simoncodephere profile image
Simon Pfeiffer Codesphere Inc.

Thanks! Glad you enjoyed it.

Collapse
 
lvbuwei profile image
lvbuwei

Good article. Thanks for sharing. i trust postgres

Collapse
 
ahrasel profile image
AH Rasel Ahamed

Good article. Thanks for sharing