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
stimw14mo ago
I definitely believe that, if you are not sure whether to choose SQL or NoSQL, then do not choose NoSQL....
BarMemes
BarMemes14mo ago
Surely we need both though to handle excessive reads and writes to the database?
Neto
Neto14mo 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
BarMemes14mo 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
owenwexler14mo 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
VictorTimi14mo ago
Redis, because it's fast, especially if you're building a chat app
BarMemes
BarMemes14mo 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
Keef14mo ago
Graph database doesn’t replace an apps api it’s just another way of storing and organizing data
Sybatron
Sybatron14mo ago
maybe they are mistaking it for graphql?
Keef
Keef14mo ago
Probably but I'm just trying to clear it up
BarMemes
BarMemes14mo ago
Apologies @keef @Sybatron is right, I meant to say GraphQL vs REST API.
Keef
Keef14mo 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
Neto14mo ago
as a simpler rule
BarMemes
BarMemes14mo ago
I got confused because @Own3r3k mentioned graph databases earlier and I got my posts mixed up.
Neto
Neto14mo ago
use plain sql and later changes if you need
Keef
Keef14mo ago
yep I was trying to figure out how to say that
Neto
Neto14mo ago
moving from sql is easier than moving to
Keef
Keef14mo 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
Neto14mo ago
the scale is very important
Keef
Keef14mo ago
If your project takes off you can pay some experts to help you move it to a more scalable system
Neto
Neto14mo ago
if you are doing a poc, sql is just fine sql with correct indexes is amazing
BarMemes
BarMemes14mo 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
Neto14mo ago
dynamo is a tricky database do you guys know the data access pattern? like, really really coordinated already
BarMemes
BarMemes14mo 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
Neto14mo 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
Neto14mo ago
Neto
Neto14mo ago
like this
BarMemes
BarMemes14mo 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
Neto14mo 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
BarMemes14mo 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
Neto14mo 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
Neto14mo ago
also something like this is a nice resource
BarMemes
BarMemes14mo ago
I read that Discord recently moved from Cassandra to ScyllaDB, which I found interesting. They made a tonne of customisation though…
Neto
Neto14mo 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
Sybatron14mo ago
but they have trillion messages already that's why they needed the change 😅
BarMemes
BarMemes14mo 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
Sybatron14mo ago
same with cassandra they just hit performance dead end
Neto
Neto14mo ago
cassandra is written in java and jvm is a resource hog plus cassandra is a pain to deal with
BarMemes
BarMemes14mo ago
So what would you recommend as your ideal SQL and noSQL combo for a social network?
Neto
Neto14mo 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
BarMemes14mo 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
Neto14mo ago
planetscale pricing is amazing you can per usage they use same tech that youtube is using (vitess)
BarMemes
BarMemes14mo 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
Neto14mo 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
BarMemes14mo ago
Awesome, thank you 🙏