DEV Community

What Database to use?

Diogo Ribeiro on August 13, 2022

What you guys' think is the best type of database ( Mysql,postgresql,mongodb... ) And provider ( aws, azure, supabase... ) for a Saas?

Collapse
 
amabe_dev profile image
amabe_dev

I am not a software architect, but in my opinion, there is no best kind of database. It depends of what you need to do.

If you have a strict schema, relations between entities and not a huge volume of data, relational databases may be a good choice. (I like PostgreSQL for that.)

If you don't have a strict schema or have a huge amount of data or traffic, databases like MongoDB might be a better fit.

And it also depends on what you need for the choice of the provider. Sometimes a self-hosted database is also a good choice.

Collapse
 
diogovski profile image
Diogo Ribeiro

I'm going to build a tool to automate social media posts, so i will need to save a lot of data regarding the posts of each user for each social they have connected to their account. Besides that i will need to have on my server a code that will call my database each minute and check if it should post something at that time ( since they are scheduled per request of the user )

Collapse
 
pencillr profile image
Richard Lenkovits

To me this doesn't sound like highly relational data. I think a nosql document database would be fine. But the main question is where do you host or do you have a service provider? Because then the best is to use something your provider already has.
If AWS I would say use Dynamo DB.
If Google then I'd use firebase's document database.
If something like heroku, I'd use their mongoDB plugin.etc

Collapse
 
imthedeveloper profile image
ImTheDeveloper

A standard relational database will handle this perfectly fine. Postgres is versatile and will handle the use case.

Collapse
 
bias profile image
Tobias Nickel

For node.js I devekoped trdb. it is a db in a single json file. I estimate it is good for the first 10000 records.

Then the api is designed in a way, that it can be easily replaced with mongo or sql databases, without to much code changes.

I developed it after using json-server for a few personal projects. because: while json server is good for prototyping frontend applications and with trdb I wanted to target backend developers backend, to get prohects started quickly and be sure, that the applucations can change to real databases once needed.

trdb, similar as json-server want you get started with your projects, because I believe, most projects fail, because they never got started.

Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

It depends on your SaaS needs.

To put it straightforward, Relational databases are efficient at processing queries and joining data across tables, making it easier to perform complex queries against structured data, including ad hoc requests. Non-Relational databases lack consistency across products and typically require more work to query data, particular as query complexity increases.

Relational databases

Offer many important features that make them aptly suited to enterprise workloads, which is why organizations have been turning to them for so long. They’re optimized for handling highly structured data, and their inherent characteristics -such as normalization, atomicity, and consistency- ensure the integrity of that data throughout its lifespan. These features also contribute to better storage utilization, while providing flexible query support through standards-based SQL.

Non-relational databases

There are different types of non-relational DBs

  • Key-value databases. Data is stored in a key-value structure that associates unique identifiers with specific data blobs, making it possible to store just about any type of data in whatever form it’s delivered. Example products include Redis, Berkeley DB, and Amazon DynamoDB.
  • Document databases. Data is stored as documents in a format such as JSON or XML, with each document assigned its own unique key, but without being limited to predefined fields or elements. Example products include MongoDB, CouchDB, and BaseX.
  • Column-oriented databases. Data is stored as strongly-typed columns rather than rows, making it possible to query and aggregate large volumes of data very quickly. These types of databases go by other names as well, such as column-store, wide-column store, and column-family. Example products include HBase, Bigtable, and Cloudera.
  • Graph databases. Data is stored in graph structures that define how the data is interconnected, essentially treating the relationships between the data as important as the data itself. Product examples include Neo4J, and InfiniteGraph.

If it was me I'd probably use PostgreSQL stored in a cheap VPS to begin with.
If you need to scale the DB there's always options to scale your VPS instance resources (vCores, RAM, disk space) and if needed, you can either distribute your DB through different VPSs or migrate to a cloud platform in a future.

Collapse
 
bias profile image
Tobias Nickel

what about pocketbase.

it is a headless cms and realtime database. Backed by golang and sqlite in single process mode, you can serve 10 000 concurrent users from any cheap 6$ vps. Once your app outgrow this db, you likely have the money and the knowledge what bigger scaling database will be the best choice.

Collapse
 
deivinsontejeda profile image
Deivinson Tejeda

If you want a database with wide capabilities go for postgresql. It has many features and flexibility of NoSQL world.

Provider aurora, serverless db with support in many engines. What I like of aurora is the ability to scale up/down transparently.

Collapse
 
tipseason profile image
Tip Season

If you need relational data, MySQL and Postgres are the best bet. From a developer standpoint, here is a comparison between postgres vs mysql .

If its NoSQL and you can self manage instances,
MongoDB is definitely a good option. AWS even offers managed Mongodb.

Regarding AWS, Azure it highly depends on your tech stack and cost you currently have.

Collapse
 
thejuju profile image
Julien Gabriel

I'm so bored with that kind of question...
You should absolutely know that every type of database has its own scope of use. There is no "best" type of database.
It depends on several criteria that you do not expose on you topic :

  • estimated size
  • estimated amount of entries at the beginning and also in a close future
  • type of data you'd like to store
  • anonymization needed
  • your budget
  • licensing constraint
Collapse
 
limavit profile image
limavit

Oracle

Collapse
 
wjplatformer profile image
Wj

unless you want security. 🤣

Collapse
 
ilteriskeskin profile image
Ali İlteriş Keskin

We use main database MongoDB side database postgresql and mysql. Project deployed on the aws. We are heybooster! 😍

Collapse
 
behrjozef profile image
Jozef Behr

I use mysql..

Collapse
 
eric23 profile image
Eric

HarperDB is a good option. SQL/NoSQL.