Best database for a social network if starting from scratch today?

Database Gurus, I’d love your advice! I’m building a new social network that has a combination of a feed/wall and a Discord-style chat. What database would you recommend and why? Eg. SQL, noSQL or a combination of the two and what types eg. MySQL, DynamoDB etc
45 Replies
stimw
stimw2y ago
I definitely believe that, if you are not sure whether to choose SQL or NoSQL, then do not choose NoSQL....
BarMemes
BarMemesOP2y ago
Surely we need both though to handle excessive reads and writes to the database?
Neto
Neto2y ago
Depends a lot on the data You can parse sql data into nosql, but the opposite is very hard And you can use both if you want to
BarMemes
BarMemesOP2y ago
The noSQL would be mostly for “hot” data when synchronously chatting back an forth, when users need to read and write quickly. Did you have a preference on what type of SQL and noSQL database?
owenwexler
owenwexler2y ago
I would say either SQL or maybe even a graph databases because a social network of any kind is going to have a lot of complex relations which is definitely not a good use case for a NoSQL db.
VictorTimi
VictorTimi2y ago
Redis, because it's fast, especially if you're building a chat app
BarMemes
BarMemesOP2y ago
Thanks @VictorTimi, why would you choose Redis over DynamoDB? Thanks @OwenWexler. Why would you use a graph database instead of REST API or tRPC?
Keef
Keef2y ago
Graph database doesn’t replace an apps api it’s just another way of storing and organizing data
Sybatron
Sybatron2y ago
maybe they are mistaking it for graphql?
Keef
Keef2y ago
Probably but I'm just trying to clear it up
BarMemes
BarMemesOP2y ago
Apologies @keef @Sybatron is right, I meant to say GraphQL vs REST API.
Keef
Keef2y ago
Yeah dw about it 😄 I was just making sure you were aware but graphql benefits are usually for fetching exactly what you need vs over fetching with REST, It does well in a app that has a different language as the API being consumed
Neto
Neto2y ago
as a simpler rule
BarMemes
BarMemesOP2y ago
I got confused because @Own3r3k mentioned graph databases earlier and I got my posts mixed up.
Neto
Neto2y ago
use plain sql and later changes if you need
Keef
Keef2y ago
yep I was trying to figure out how to say that
Neto
Neto2y ago
moving from sql is easier than moving to
Keef
Keef2y ago
This is a very broad question and it can have lots of answer but it requires things like knowing how many users use the app
Neto
Neto2y ago
the scale is very important
Keef
Keef2y ago
If your project takes off you can pay some experts to help you move it to a more scalable system
Neto
Neto2y ago
if you are doing a poc, sql is just fine sql with correct indexes is amazing
BarMemes
BarMemesOP2y ago
We are starting out with MSSQL and DynamoDb with REST API. I just wanted to make sure that’s the best approach and we’re not going to run into issues. The app is being coded in Xamarin.
Neto
Neto2y ago
dynamo is a tricky database do you guys know the data access pattern? like, really really coordinated already
BarMemes
BarMemesOP2y ago
I’m more involved with the UI/UX and concept of the app. My developer handles the code and he’s used DynamoDB before and he’s comfortable with it, plus he thinks it’ll be easier and cheaper to find additional developers for MSSQL and DynamoDB because they’re older and more established platforms. He also doesn’t see the point of graphQL if you setup the REST API’s properly. I just want to get a better understanding of what’s out there and avoid any big issues as we scale. My background is more in IT and cloud computing infrastructure.
Neto
Neto2y ago
if the plan is to use graphql just as a typesafe api its just weird to use it if you really plan to use it like a graph, the main usage for facebook (lol), then its an amazing tool
Neto
Neto2y ago
Neto
Neto2y ago
like this
BarMemes
BarMemesOP2y ago
The plan is to have functionality like Discord, but also have a social “wall” like Instagram and run it over the Matrix.org protocol. Thanks for the video, I’ll check it out 😀 Would would be fine starting off with an SQL database and then moving to a graph database as the app becomes more complex or are we better off starting out with a graph database. Would we be fine just using an SQL database with GraphQL?
Neto
Neto2y ago
just as a example you can use a sql database to hold the main data and some fast read database, like dynamo, to keep view data so you don't have to calculate stuff on requests
BarMemes
BarMemesOP2y ago
Also, if we were going to use a graph database, which would you recommend? Neo4j, MemGraph, NebulaGraph, AllegroGraph, Redis, Cassandra with DataStax, AWS Neptune, GraphDb, ScyllaDB with JanusGraph etc
Neto
Neto2y ago
Exponent
YouTube
Design Reddit: System Design Mock Interview
Don't leave your career to chance. Sign up for Exponent's system design interview course today: https://bit.ly/36Z09jp In this interview, Kevin (fmr Google, Tesla Engineer) answers a system design interview question of designing Reddit, commonly asked in engineering management, software engineering and technical program management (TPM) intervi...
Neto
Neto2y ago
also something like this is a nice resource
BarMemes
BarMemesOP2y ago
I read that Discord recently moved from Cassandra to ScyllaDB, which I found interesting. They made a tonne of customisation though…
Neto
Neto2y ago
cassandra is not a graph database cassandra is a kkv a option to dynamodb using just sql is fine to start with later migrate data to "better" database alternatives as the data is normalized, you can easily aggregate it
Sybatron
Sybatron2y ago
but they have trillion messages already that's why they needed the change 😅
BarMemes
BarMemesOP2y ago
Great! That’s very reassuring. I’m picturing this nightmare scenario where we pick one architecture and then we’re stuck with it… 😅
Sybatron
Sybatron2y ago
same with cassandra they just hit performance dead end
Neto
Neto2y ago
cassandra is written in java and jvm is a resource hog plus cassandra is a pain to deal with
BarMemes
BarMemesOP2y ago
So what would you recommend as your ideal SQL and noSQL combo for a social network?
Neto
Neto2y ago
mysql (planetscale) is amazing scylla is amazing for something like discord if you plan on adding search, then something like elasticsearch or meilisearch would be good too scylla and dynamo can share a similar role at that, its more of preference and experience
BarMemes
BarMemesOP2y ago
Why would you recommend MySQL on PlanetScale vs on other provider and why MySQL over MSSQL? Is it just licensing and hosting costs or is MySQL a better database for this use case?
Neto
Neto2y ago
planetscale pricing is amazing you can per usage they use same tech that youtube is using (vitess)
BarMemes
BarMemesOP2y ago
Yeah it looks really good. We’re abusing AWS for all their free startup credits at the moment and then may move to PlanetScale once they dry up. Kind of stuck if we stick with DynamoDB though…
Neto
Neto2y ago
if dynamo is not the main database its fine to move away you just would have to "reseed" the data in another nosql
BarMemes
BarMemesOP2y ago
Awesome, thank you 🙏
Want results from more Discord servers?
Add your server