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.

Link to the patch:
http://bugs.monetdb.org/attachment.cgi?id=158&action=edit

Link to the bug:
http://bugs.monetdb.org/show_bug.cgi?id=3178

Any comments or suggestions will be greatly appreciated.

Thanks,
Yinhe