logoalt Hacker News

consumer451today at 2:52 PM8 repliesview on HN

> Multiple applications sharing a database [0]

> Regret

Thanks for this data point. I am currently trying to make this call, and I was still on the fence. This has tipped me to the separate db side.

Can anyone else share their experience with this decision?

[0] https://cep.dev/posts/every-infrastructure-decision-i-endors...


Replies

JamesBarneytoday at 9:43 PM

The issue wasn't sharing a database, it was not being clear about who owns what.

Having multiple teams with one code base that has one database is fine. Every every line of code, table and column needs to be owned by exactly ONE team.

Ownership is the most important part of making an organization effective.

zietoday at 3:15 PM

My advice: One code base and one database.

In my experience, it's easier to take schema out into a new DB in the off-chance it makes sense to do so.

The big place I'd disagree with this is when "your" data is actually customer data, and then you want 1 DB per customer whenever you can and SQLite is your BFF here. You have 1 DB for your stuff(accounting, whatever) and then 1 SQLite file per customer, that holds their data. Your customer wants a copy, you run .backup and send the file, easy peasy. They get pissed, rage quit and demand you delete all their data, easy!

show 1 reply
darth_avocadotoday at 7:58 PM

Coming from a world of acquisitions, I see almost every startup make the same decision of having a single database for everything. Can’t stress enough how big of a problem this becomes once you scale even a little bit. Migrations are expensive and time consuming. And for most teams, moving an application to a different db almost always becomes an urgent need, when they are least able to.

austinsharptoday at 6:03 PM

Highly recommend reading Designing Data-Intensive Apps [1] and Monolith to Microservices [2]. I can't remember which (maybe both?) but I definitely took away the idea that if services share a DB, that DB's schema is now a public interface and becomes much more difficult to evolve with new requirements.

[1] https://www.amazon.com/Designing-Data-Intensive-Applications... [2] https://www.amazon.com/Monolith-Microservices-Evolutionary-P...

show 1 reply
kwilletstoday at 5:24 PM

He doesn't want to manage the database the way he manages the rest of his infrastructure. All of his bullet points apply to other components as well, but he's absorbed the cost of managing them and assigning responsibilities.

- Crud accumulates in the [infrastructure thingie], and it’s unclear if it can be deleted.

- When there are performance issues, infrastructure (without deep product knowledge) has to debug the [infrastructure thingie] and figure out who to redirect to

- [infrastructure thingie] users can push bad code that does bad things to the [infrastructure thingie]. These bad things may PagerDuty alert the infrastructure team (since they own the [infrastructure thingie]). It feels bad to wake up one team for another team’s issue. With application owned [infrastructure thingies], the application team is the first responder.

OJFordtoday at 3:09 PM

What's the DBMS? We moved in the other direction with postgres, merged multiple databases to simply have a schema per service/application instead. All the advantages with none of the disadvantages, imo. (We then had a single database per running test/dev environment, rather than multiple.) Of course, that's a pg thing, if you use MySQL for example it's not an option.

show 2 replies
intrasighttoday at 3:08 PM

Accept that eventually you'll have multiple databases, so it makes sense to plan from that from the start and get in place the mechanisms for the databases to talk to each other.

show 1 reply
zmjtoday at 4:41 PM

Separate! You lose the flexibility to move logic between the application and the database when the database is its own API.