4 ms·
That, or just a string in your application’s code. The problem with using the ORM as you describe is that when you hit any sort of scale, you need to be doing
by jeffdn 4y ago
That, or just a string in your application’s code.
The problem with using the ORM as you describe is that when you hit any sort of scale, you need to be doing bulk operations, otherwise your latency goes through the roof, to the point that the number of inefficient queries you are doing can tank the database. I speak from the experience of having seen a database collapse under the load of a backend written in this fashion having request load grow past a certain point — not pretty! The interim solution is to bulkify existing queries and functions in place to the greatest extent possible, while preparing for:
Converting a codebase from having endpoints doing individual ORM operations as described to having proper separation of concerns with a business logic layer between the endpoints and the database is a _massive_ cost. The earlier you implement that, the happier you will be in the longer term. It doesn’t have to be with raw SQL, but many bulk operations are much easier to express with SQL than with the ORM.
- cloverich 4y agoDoesn't an escape hatch on the ORM provide that though? I seem to remember in both sqlalchemy and (libraries that use) knex being able to dip down into SQL when needed.
- foobarian 4y agoCoincidentally, modern graphQL backend libraries will do this for you. See e.g. graphql-java, apollo-server, many others.
- gnaritas 4y ago