I am currently developing an e-commerce system, and for now, I'm using the type numeric to save the price of the products on my database. I want to know if this is the best practice or if I should use double-precision or another type.
Asked
Active
Viewed 914 times
-1
-
[Don't use money](https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_money) – Jun 18 '21 at 21:47
1 Answers
2
Numeric
is the best practice for storing prices.
In general, you want to avoid floating point representations for numbers because they can have rounding errors and precision errors -- that might add up over large quantities of numbers.

Gordon Linoff
- 1,242,037
- 58
- 646
- 786