News for hackers. Stuff that matters.
Re:Ask HN: Do you self-host your database? by codewithcheese on Tuesday June 29, 2021 @06:10AM (#27673902)
Slack used to partition their databases per workspace (customer) and then moved away from it. The "Disadvantages" section lists reasons not to do that. https://slack.engineering/scaling-datastores-at-slack-with-v...

Two disadvantages that stand out for me are:

1. You must be able to scale the database up to your biggest customer and down to the your smallest this can be increasingly difficult to provision.

2. You are stuck with customers being isolated and makes it much harder to develop features that cut across a group of customers.

Re:Ask HN: Do you self-host your database? by andix on Tuesday June 29, 2021 @07:10AM (#27674234)
2. can be a huge security feature. If your web application only has access to the database of this one customer, you practically can't leak data from other customers by accident.
Re:Ask HN: Do you self-host your database? by renewiltord on Tuesday June 29, 2021 @11:13AM (#27676979)
Slack has cross-workspace connectivity and communication as a product feature. It’s a really cool feature.
Re:Ask HN: Do you self-host your database? by panta82 on Tuesday June 29, 2021 @07:19AM (#27674303)
My experience mirrors that.

If you have a dynamic set of databases or even tables, be ready to invest into tooling to recreate features you take for granted in a normal database.

Re:Ask HN: Do you self-host your database? by littlestymaar on Tuesday June 29, 2021 @08:03AM (#27674655)
> 1. You must be able to scale the database up to your biggest customer and down to the your smallest this can be increasingly difficult to provision.

IIRC, Slack had a lot of scaling issues when they won a deal with IBM. Jumping from medium-size customers to such a behemoth will obviously be a challenge, but a lot of the difficulties they faced was non-technical and more business-related (“What do you mean, you want our product but not our monthly plan charged per seat?”). Anyway, that's a nice problem to have for a start-up ;).

Re:Ask HN: Do you self-host your database? by giovannibonetti on Tuesday June 29, 2021 @11:03AM (#27676814)
IIRC this is the kind of problem that CockroachDB seems to solve well, given their implementation of range partitioning with automatic rebalancing. This ensures the partitions are evenly distributed even with an uneven customer distribuiton.

I have no affiliation with the product, but I have been comparing alternatives and it seems like that's where it shines.

Re:Ask HN: Do you self-host your database? by OJFord on Tuesday June 29, 2021 @06:17AM (#27673937)
2 can be a feature too!
Re:Ask HN: Do you self-host your database? by renewiltord on Tuesday June 29, 2021 @11:22AM (#27677138)
This is a good post. Thanks for sharing!
Re:Ask HN: Do you self-host your database? by laurent92 on Tuesday June 29, 2021 @08:11AM (#27674727)
3. By splitting, you can give your customers control on data residency, as mandatory in GDPR,

4. By splitting, you limit the exposure in case of SQL injection.

5. By splitting, you can have good performance for the customer who has 1M records, and good performance for the 100K customers with 10 records.