Take the 2-minute tour ×

How much less efficient would it be to store some fields as a BigDecimal instead of as an Integer in a Rails app?

Some computation (a bunch of arithmetic) will be done with these values.

Does this affect performance for Rails, the database or Ruby in general?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

BigDecimal is less efficient than integer in most ways that matter. They take up more space, and floating-point math is slower than integer math.

Having said that, unless you're doing an awful lot of calculations, it's probably fine to use BigDecimal, and you probably won't notice.

share|improve this answer
add comment

Your Answer


