Forum: Building VoltDB Applications

Post: Decimal Datatype

Decimal Datatype
Raveendra
Aug 22, 2011
Hi,

I have following questions regarding the decimal data type:

1. For performance we want to use the decimal data type instead of varchar as in MySQL but when we want to store some big decimal value in VoltDB, it throwing error saying "decimal has maximum of 26 precision to the left of decimal point". Is there any alternative way to store the very large number apart from varchar.
2. What will be the impact of performance and memory utilized to store the decimal value in column with data type varchar instead of decimal.

Thanks and regards
Ravee
Hi, 1. For performance we
aweisberg
Oct 7, 2011
Hi,

1. For performance we want to use the decimal data type instead of varchar as in MySQL but when we want to store some big decimal value in VoltDB, it throwing error saying "decimal has maximum of 26 precision to the left of decimal point". Is there any alternative way to store the very large number apart from varchar.
The DECIMAL type in VoltDB uses a fixed scale (12) and precision (26). Do the numbers you want to store exceed that scale and precision? If they don't can you send me the code you used to instantiate the BigDecimal so I can try it out?

2. What will be the impact of performance and memory utilized to store the decimal value in column with data type varchar instead of decimal.
There is a loss of space efficiency, but not as bad as for larger strings. A string that is 63 characters or less is inlined into the tuple. I believe you also lose some space efficiency if you index the column because the string will be inlined there as well.

Sorry for the late reply!
Ariel