Skip to content

num_vals()

Calculate the number of values in a one-dimensional statistical aggregate

Since 1.3.0

Calculate the number of values contained in a statistical aggregate.

Calculate the number of values from 0 to 100, inclusive:

SELECT num_vals(stats_agg(data))
FROM generate_series(0, 100) data;
num_vals
--------
101

The syntax is:

num_vals(
summary StatsSummary1D
) RETURNS BIGINT
NameTypeDefaultRequiredDescription
summaryStatsSummary1D-The statistical aggregate produced by a stats_agg call
ColumnTypeDescription
num_valsBIGINTThe number of values in the statistical aggregate