Hi,
The current implementation of ALGstdev_@1
in monetdb5/modules/kernel/algebra.mx
takes two scans of the BAT. First scan to compute the sum (average) Second scan to compute stdev. By using a well-known mathematical property of the stdev, one scan is enough: during the scan, the sum of the value and the square of the value can be computed together, and the stdev can be computed then. The new implementation would roughly cut the running time by
half for most of meaningful cases, especially when the bat is big.