node-mysql2 icon indicating copy to clipboard operation
node-mysql2 copied to clipboard

Feature request: Add an ability to trim trailing zeros in decimals

Open KAMAELUA opened this issue 1 year ago • 1 comments

My team recently faced an issue with current decimal representation in string. Our database migrates to decimal(38,16) -- this is a pretty big decimal precision, but in real environment there could be only one record of 100k rows with such precision.

So, in most cases, we began to receive a lot of data with zero characters like 0.0000000000000000 - this value is equals to 0, but it cause to grows up memory usage and JSON size in component communications.

Therefore, I would like to propose to add an ability to trim trailing zeros in decimals and control it by passing variable to connection config.

KAMAELUA avatar Jul 31 '23 17:07 KAMAELUA

Thats an oddly specific flag. Before we discuss the PR a question - have you considered typeCast? Do you want ti have your change that low for a performance reason or there are other considerations?

sidorares avatar Aug 01 '23 01:08 sidorares