4 ms·
I agree but I’m talking in the context where you can’t vertically scale anymore. I also don’t think it’s worth the trouble “never using joins” for an existing
by endisneigh 3y ago
I agree but I’m talking in the context where you can’t vertically scale anymore.
I also don’t think it’s worth the trouble “never using joins” for an existing project. Denormalize as necessary. But for a green one I honestly think since our access patterns can be understood as you continue you can completely get rid of joins.
Again, assuming your new project can’t fit on a single machine. If it can you’re best just following the “traditional” advice, or better yet keep everything in memory.
- fastball 3y agoHow is it that your new project can't fit on a single machine?
- cuu508 3y agoPerhaps they're building an internet search engine.
- yafbum 3y agoCould be plenty of reasons, but say you want to support spikey traffic like whatever is related to events, news, realtime information, etc., or highly seasonal stuff like a school portal or selling flowers on mother's day, you want the ability to scale horizontally very quickly to accommodate spikes
- aidos 3y agoEveryone thinks they start their project with Facebook scale problems.
- crazygringo 3y agoWell then you're only really talking about < 0.1% of projects, since a single server and replication and caching will get you as far as you need, even for most social networks. And if you are needing to massively shard because you're Facebook or Twitter, then it's not much of a hot take at all. But it's also massively oversimplified advice. Because the tradeoffs between joins and denormalization depend entirely on each specific scenario, and have to be analyzed use case by use case. In many cases, joins still win out -- e.g. retrieving the profile name and photo ID for the author of each post being displayed on your screen. I'm just worried that people without experience will see your advice and think it's a good rule of thumb for their single-server database, because they think joins are scary and you've provided some kind of confirmation.