Skip to main content
Calculate the number of values contained in a two-dimensional statistical aggregate.
num_vals(
  summary StatsSummary2D
) RETURNS BIGINT

Arguments

NameTypeDefaultRequiredDescription
summaryStatsSummary2D-The statistical aggregate produced by a stats_agg call

Returns

ColumnTypeDescription
num_valsDOUBLE PRECISIONThe number of values in the statistical aggregate

Samples

Calculate the number of values from 1 to 5, and from 0 to 100, inclusive:
SELECT num_vals(stats_agg(y, x))
  FROM generate_series(1, 5) y,
       generate_series(0, 100) x;
num_vals
--------
505