views:

263

answers:

1

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?

+1  A: 

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.

Tim Sullivan