zed icon indicating copy to clipboard operation
zed copied to clipboard

Aggregate functions for statistics (e.g., stddev)

Open philrz opened this issue 9 months ago • 1 comments

SuperSQL currently lacks built-in aggregate functions for calculating statistics (such as standard deviation and variance).

Details

At the time this issue is being opened, super is at commit 6ca49b7a.

A user recently inquired in a community Slack thread:

i trying to make standard deviation op, any tips?

SuperSQL currently lacks these as built-in functions, but since we aspire to have base SQL support similar to what's found in Postgres we recognize we should add them, e.g., here's the list of the ones in Postgres.

@mccanne has noted that Welford's online algorithm is an accepted "one-pass" approach for calculating variance and therefore we should probably use it in our own implementation.

philrz avatar Apr 14 '25 23:04 philrz

Rolling versions is also good idea.

So the x last values is used for calculating and not all of them

OzzyKampha avatar Apr 19 '25 21:04 OzzyKampha