4 ms·
Leaving it too generic brings your backend application to give up on performance, by refusing to optimize the data layer. Working towards a better Database opt
by mister_hn 6y ago
Leaving it too generic brings your backend application to give up on performance, by refusing to optimize the data layer.
Working towards a better Database optimization leads to huge speedups in the application itself.
A well done store procedure beats easily any ORM construct (especially JPA in Java).
And what about dealing with error handling? Tighting the error handling to model makes it easier to unit test it extensively and enables DRY on your codebase, since you don't have to repeat the error checking in all the places your model is used.
- pmontra 6y agoWhich tools do you use to deploy stored procedures and to run tests? I mean, plain SQL files and any languages that can interface the FB would do, but is there anything purposely made for that?
- mister_hn 6y agoI usually deploy them as SQL files. I keep my SQL statements as close to standard as possible, so a change in Database Engine (say MySQL-->Postgres) results in a simple step. The unit tests can be performed as a bunch of SQL statements passed as input to the database client and verify that it works as expected. This level (the unit test) can also be done with any programming language of choice, to make the task easier.