Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



Except if a database upgrade fixes a floating point issue. Or the engine may not be as capable of doing calculations on floating point logic!


I specifically said non-floating point. I have not used any database that would screw up a decimal type. It would lead to mass migration away in certain very well paying industries.


Sorry, missed that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: