DEV Community

Discussion on: What database should I use?

Collapse
 
jdog787 profile image
JDOG787

Hmm, ok. I agree that Mongodb is great for some cases, but I've heard that SQL is good for certain cases as well. But they also scale better than monogdb(so I've heard), which is what I'm looking for. I'm going to make a social media app, but I want it to be able to scale easily if needed.

So for this case would you say to use a SQL database?

Collapse
 
leob profile image
leob

"... they also scale better than mongodb ... which is what I'm looking for"

Eh no, it's the other way around actually - NoSQL databases (like Mongo) potentially scale better than SQL databases (RDBMS) ... with NoSQL you can scale out "horizontally" (using 'shards' on different machines), with SQL databases there are limitations in that regard - conventionally a SQL database has to run on one big fat machine.

So if it's really all about extreme scalability for you, then MongoDB would be your choice. I'd say SQL databases are better/easier than NoSQL in almost all respects (ease of use, powerful query language with joins, normalized data model, defined schema, ACID), except for scalability - that's where NoSQL shines - at least in theory :-)

But, we're talking about giga scale here ... will your social app really be that huge? You're not going to build a new Facebook or are you :-)

Thread Thread
 
jdog787 profile image
JDOG787

Oh, I guess I got them mixed up lol.

will your social app really be that huge?

No, I don't think so, but I'm partly wondering which kind of database is better, and partly planning ahead.

You're not going to build a new Facebook or are you :-)

Probably not, but that would be cool :D

So you think mongdb is a good choice?

Thread Thread
 
leob profile image
leob

What stack (backend) are you gonna use, node/express or something else? Social media app, you need streams/channels for realtime ... I'm thinking GraphQL and all that ... Prisma? prisma.io which supports PostgreSQL and MySQL. But yeah "social media" = "big amounts of non structured data" (text, images, audio/video)" means MongoDB does sound like a good fit.

Thread Thread
 
jdog787 profile image
JDOG787

Yeah, I'm thinking node/express, and graphql. Never heard of prisma though. And yeah, I guess mongdb is good, so I'll go with that! Thanks for all the info and help >:)

Thread Thread
 
leob profile image
leob

Mongo is a good choice if you have an app where (a) you don't have an extensive data model with lots of relations/joins (like an accounting system, or other "line of business" apps), and (b) you need to store lots of unstructured data like text, images, video/audio and so on.

So your social media app fits the bill, while I'd never ever try to develop an accounting app with Mongo as the data store :-)

Thread Thread
 
jdog787 profile image
JDOG787

Ok, good to know. Thanks!