types caused performace issue
harryhan1989 opened this issue · 1 comments
harryhan1989 commented
for _, key := range model.Keys {
col := column.New[types.Decimal64]()
for _, d := range model.Values[key] {
col.Append(types.Decimal64FromFloat64(d, 3))
}
keys = append(keys, key)
columns = append(columns, col)
}
for Decimal64 field, i have to loop append, for performace issue i want to use Append(d...),
also ,if the types.Decimal64 can use Add, subtract, multiply and divide directly ,
i will not covert Decimal64 to float64 on db reading and then convert back for db writing.
types.Date and types.Datetime is the same ,if it can directly use compare function , it will be better
vahid-sohrabloo commented
Sorry for the delayed response.
I was AFK.
You can do it if you better know the decimal in the clickhouse. in the clickhouse decimal 32 is the same as int32 and decimal 64 is the same as int64. So, for example, if the scale is 2
, 2.65
is equal to 265
in int32.
and you can use int32. and if you look at the code. Decimal32
is a subtype of Int32