> And then they will depend on your API data schema...
+100 to this
But that API schema is unrelated to the underlying DB schema. I’ve been able to run services with different backends (eventually consistent & low latency vs transactional) exposing the same API. That would not have been possible by just giving consumers access to a DB.
The DB can do everything can’t seem to understand this, for some reason.
Re:For Want of a JOIN
by marcosdumay on Thursday December 22, 2022 @02:31PM
(#34097453)
Moving the goalposts, I can see.
Of course, merging different backends can not be done on the backend. Either you add a layer or you do it on the client.
That seems to be an odd way of looking at it, IMO. Most of the time, the entire point of building an API is to present consistent functionality to any consumer, not only ones under your control. Also, a well-behaved API is versioned so as to allow evolution of the API without breaking existing clients who can upgrade to new versions as they are able.
Any nontrivial change to the base model will mean a lot of complexity in the API layer and degraded performance. Maybe that's worth it for you, maybe if you're exposing this data to hundreds of external users who don't need high performance. But I feel that for most usecases, barebones DB access is the better option.
Re:For Want of a JOIN
by dragonwriter on Saturday December 24, 2022 @11:26AM
(#34118297)
> That would not have been possible by just giving consumers access to a DB.
That depends on the DB's foreign table support, or equivalent, if it has it. It's certainly not categorically impossible with a DB.
> And then they will depend on your API data schema...
Which we have methods of evolving. I can put my API in gRPC and know exactly which changes will or won't break compatibility. Try doing that with a database.
And then they will depend on your API data schema...
Yes, schema evolution is hard, but databases have many tools to help here that you will either have to recreate on your APIs or live without and have a harder time. Either way, all the trouble comes from data evolution, and any schema-only change is trivial to deal with.
Data distribution is something that varies from one DB to another, they usually have very good performance that is hard to replicate on your application layer, but are very hard to setup and keep running. But the point about control of resource usage is a good one.