4 ms·
If you are using numeric data (not floats) in the database, I would say do your calculations in the database. Different languages and tools have different arit
by protomyth 13y ago
If you are using numeric data (not floats) in the database, I would say do your calculations in the database. Different languages and tools have different arithmetic handling which can cause some very long and psychotic debugging sessions. A single point of calculation is a good thing.
[edit] I should explain a bit. If you use are in a multi-language environment[1] and are doing financial or weight / volume calculations, be extremely careful if you decide to not do all the calculation on the database. Having results calculate differently in two different places will drive you mad. I have noticed some serious problems with number handling in different languages and some mistakes in calculation will get you sued.
1) SQL counts as one of the languages
- chris_wot 13y agoExcept if a database upgrade fixes a floating point issue. Or the engine may not be as capable of doing calculations on floating point logic!