influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
29.05k stars 3.56k forks source link

[Feature request] Support of BigInt or Decimal data type #24204

Open XIELongDragon opened 1 year ago

XIELongDragon commented 1 year ago

The issue https://github.com/influxdata/influxdb/issues/8982 has been closed. But it is really very important that high precision is supported in financial data.

Proposal: Decimal or BigInt is commonly used in financial data, especially in the crypto area.

Current behavior: No proper way to do it

Desired behavior: Aggregation works on decimal values, whether by introducing a new type or changing functions behavior or adding the CAST operator.

Use case: storing and querying currencies or prices or other data where precision is highly important.

MariaCobretti commented 1 year ago

this issue has been requested for a very long time now in #8982 .. are we going to see any progress on this?

amin-basiri commented 1 week ago

i am developing a crypto platform and i need to save price of currencies, but i can't save them with correct precision. i think this feature will be very helpful.

philjb commented 1 week ago

@amin-basiri - how many decimal digits (significant digits) do you need?

amin-basiri commented 1 week ago

@philjb for price i need up to 10 decimal places i am using float data type to save price, but i've facing floating points issue also to save ethereum blockchain token amount i need up to 18 decimal places

nevmerzhitsky commented 1 week ago

@philjb for price i need up to 10 decimal places i am using float data type to save price, but i've facing floating points issue also to save ethereum blockchain token amount i need up to 18 decimal places

Storing money data in IEEE-754 floats is not robust a priori. You need a particular decimal data type for this. Or convert values to integers (and convert back when you read them). Or store it as strings.

amin-basiri commented 1 week ago

my queries can be very complex when i use other approaches i think decimal data type is more convenient