Issues around replication happen with any distributed database. That doesn’t get worse with stored procedures, which don’t themselves have state.
Issues around replication happen with any distributed database. That doesn’t get worse with stored procedures, which don’t themselves have state.
When you run everything in your DB, replication issues will hit you much earlier.
Of course this all depends on what kind of app are you building. If it's an internal tool or something like that, you probably don't need to worry.
I think you’re imagining that moving business logic into stored procedures will overload the database server sooner than having that in application code. I have never seen that. Instead you get fewer simultaneous connections and less data passed back and forth. Querying a compiled view or stored proc will often use fewer resources than parsing, planning, and optimizing SQL sent from application code. And the RDBMS can make better use of caching with business logic in the database.
Scaling and replication may present complications with any architecture, but those aren’t good reasons in my opinion to not put business logic into the RDBMS. Real enterprise-scale databases tend to do that and they actually have scaling and replication issues, not just “may happen someday” issues.
What if you have complex integrations of external services, need to serialize and parse huge JSON or XML, do processing on the data and send it back and forth, accept and trigger webhooks...? That's the workload I'm imagining would be easier to scale on a separate app server.
UI and interfacing with external services will most likely prove simpler to implement in an application layer. Google and Stripe don’t have SDKs for Postgres.
If the application needs a relational database at all it makes sense to get the most value out of the RDBMS.