31

DON'T

EVER

SHARD

YOUR

DATABASE !

Trust me, don't !

Comments
  • 4
    @AlexDeLarge Haha. Trust me on that trust me
  • 1
    But any reasons as to why sharding is bad for you?
  • 7
    @ethernetzero @AlexDeLarge

    If you do it without rigorous planning, it will end up bad.

    If you have "users" and "favorite_books" in two shards, getting complex aggregates based on joins over those tables might perform very badly.

    If your application has a "central" table (like users) with a lot of 1-to-many relationships (unique per user, like addresses or pets), and you rarely need statistics over the complete set, you can horizontally shard your users -- 100k users with their addresses and pets in one DB, 100k in the next, etc. Con is in many-to-many performance -- finding users who share favorite books with a certain other user is annoying to query when data is spread over 10 dbs.

    Another option is vertical (domain) shards: Multiple products can be split into multiple databases. Con is performance on joins on the edges where your products share data.

    My approach is to not shard, just have a single read-write master, and use readonly replicated servers as much as possible.
  • 2
    @bittersweet Nice explanation, thanks a lot. 😄

    But to be precise, the subject is no longer “don't ever shard your database” so much as “don't ever shard your database without knowing what you're doing and after really careful planning”. One could say that's an understatement, but we all need to be reminded of that last part once in a while.
  • 5
    Some tutorials be like:

    Hey! there's this great thing called X.
    Here's how to do X:
    1. a
    2. b
    3. Done! Hurray!

    In reality:
    1. a fails
    Try steps 1.1, 1.2, 1.3,... To alleviate
    ... get to step 6... Realized that steps 2 and 4 have to be re-done. Go back and do 2,3,4, realize now are 5 fails. Try to do 5.1,5.2,5.3,...

    Facepalms and dies. Bury me with my computing peripherals.
  • 2
    Best not to shart it either 😂
  • 1
    @segfault0xff duuuude I read that at first too 😂
    Nice name btw
  • 1
  • 0
    📌
  • 2
    @AlexDeLarge dude, being raped by a huge black dude is not a good thing. Trust me.
  • 1
  • 2
    @AlexDeLarge just the stereotype of black dudes having big dicks. And big dudes having bigger dicks.

    You would probably not be so frightened about the damage made by a tiny Asian dude (sorry Asian dudes)

    @root 😝
  • 1
    @hell When I was managing a series of small MMOs, I would regularly make a player account and interact with players in a non-admin setting to get a feel for the community, what players liked the most, what they disliked, try to learn of exploits, etc. The games in question were fairly small (400-6k players each), so with some effort I could get to know the playerbase pretty well.

    While managing one of them (I'd switch every few months to years), one of my admittedly less serious (okay, the least serious, ever) of these toons was Bubba, a very large and very gay black man.

    Several of the players knew it was me and took it very well. Because of this, and because I was active in the pvp aspect of the game, there was even a running joke among the playerbase about not getting raped by Bubba (meaning pk'd/banned, depending). The entire thing was very jovial, and honestly Bubba was probably the most enjoyable part of that particular position.

    I had completely forgotten about that until you brought it up.
  • 1
    @Root 😂😂😂 wtf
Add Comment