DEV Community

Discussion on: What is your favorite database?

Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

The first thing to keep in mind is that you need to analyse if you need either a relational database or a non-relational database.
The second one is your budget. Do you need a relational db and in low budget?
Is this a little side-project? Use MySQL or MariaDB.
Is this meant to escale and thus you need more reliability and business features? Use Postgres, is the best you can get for free in RDBMS.

And so on.

The truth is that Project Development in IT, IRL, -out of this communities that are filled by learners or juniors mostly- is not about preferences, is about choosing the tools that you actually need and are more convenient, like it or not.
Then if you need to choose from a pair of tech stacks that are equally convenient, you can apply your preferences.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

How cheap it MySQL / MariaDB; compared to MongoDB Atlas - like, how many rows / database size?

Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

LoL... you install MySQL or MariaDB or Postgres in a VM instance for free (just linux regular apt install commands), you configure it and that's all, free for you forever. The DB size limit? your VM instance's disk space. If you picked 20Gb so the limit is 20Gb unless you scale this resource.

In other words, you don't need to "trust" the google results. You need to trust in you, at the end you are the one configuring it and making it up and running 😆

For instance, it's exactly the same that I would do with Mongo. Using Mongo from Atlas is just a convenience for learners but as you can see, it makes you dash apart the step of setting up a DB Server so you ended up thinking that effectively you need a provider for that.

docs.mongodb.com/manual/administra...
postgresql.org/

And so on. Think that for the provider being able to currently provide you with a DB Service, those database servers were installed on this provider servers in the first hand.

To sum up, the cost is the VM instance one (or a kubernetes pod or a shared hosting or a VPS or... whatever you use to set it up).

If you choose the cheapest, you can pick a web shared hosting like this one (Hosting -> web hosting) for few dollars a month and you can set up both PHP and Node webApps here along with MySQL databases on a super easy way as the environment is closed and configured already, you just interact with a CPanel to get the things done (and the support guys are glad to help you at any time).

You can also choose Servers -> VPS Servers, it's a bit more expensive and a bit more complicated as it's self managed , meaning you need to manage your instance, so you can install a mongo server on it if you want (there's also the option of paying a bit more for them IT guys to manage it for you, so you simply ask them what you want).

VPS stands for Virtual Private Server and it's more or less the same than a VM instance on Google Cloud Platform, Amazon Web Services or Azure (despite architectural and scalability concepts related to distributed systems that I don't want qualifies for a full post).
You can also get a Servers -> Dedicated Servers for a bigger price and here you are renting a full server (the entire machine itself, managed remotely) so you can put all resources together or virtualize them or... whatever you want.

Thread Thread
 
patarapolw profile image
Pacharapol Withayasakpunt

VM instances aren't free.

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇

Updated the previous comment with extra information about that.
Of course, none is for free at all in this life, in Atlas or any provider, with a free account, the priority is set for paid users first, so when the network is jammed, you're the first to loose the service so they can continue providing quality service to paid users.
They use a candy model in which you get something "for free" with no minimum availability by contract and then, if your App scales, you'll end up paying more than the cost of setting it up yourself as I've said.

To set up a reliable webApp you need to host your frontend, your backend and your Database.

The database can be a filesystem based one like SQLite 3 for example so you ship it along your backend and you can set up both front + back in the same environment.

The easiest way to set it up is on a monolith, for example, using Next js as backend server/middleware/proxy and React inside Next js for the frontend along with SQLite or MySQL in a shared hosting like the one I linked above, it's just less than 5 bucks a month and you get your own instance and your service up and running.

The good think with this hosting model is that you can set up multiple webapps in the same shared hosting even with different domains, and if you need to scale it, you can migrate the entire shared hosting or just the apps you want to an VPS to ensure better service for your customers.

Collapse
 
cipharius profile image
Valts Liepiņš

I'm wondering why do you suggest MariaDB(MySQL) for small scale project over Postgres?

Don't have that much hands on experience with MySQL like databases, but i felt like Postgres isn't much more complex, if one sticks to basic features.

Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

While the inner complexity differs, the experience using one or another is almost the same.

MySQL or MariaDB (which is a community fork of MySQL that branched out a bit) are meant for fast sort of little projects. PostgreSQL is meant for robust high reliable business-driven projects. It comes with much better tooling such PGAdmin 4.

I don't know the current state but MySQL usually showed up issues with concurrency while the Postgres way to deal with that avoid that issue at any scale.

In little projects it's difficult for the postgre benefits to show off but sure, you can stick into PostgreS for all sort of projects where you need relational DB. The only difference is that postgre is a little bit heavier by default, just that.