ReferenceSQL ReferenceAggregate Functions

varPopStable

Returns the population variance.

This page describes the RawTree engine binary used to generate this reference. It does not define Query API support. Descriptions retain upstream ClickHouse terminology. See SQL interface scope.

Returns the population variance. Unlike varPop, this function uses a numerically stable algorithm. It works slower but provides a lower computational error.

Syntax

varPopStable(x)

Arguments

Returned value

Returns the population variance of x. Float64

Examples

Computing stable population variance

DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data
(
    x UInt8,
)
ENGINE = Memory;

INSERT INTO test_data VALUES (3),(3),(3),(4),(4),(5),(5),(7),(11),(15);

SELECT
    varPopStable(x) AS var_pop_stable
FROM test_data;
┌─var_pop_stable─┐
│           14.4 │
└────────────────┘

Introduced in version 1.1.0.