count
count([item: storable]*) -> int64
Counts rows or values in a group (or window frame). With no arguments, count() behaves like counting a constant row weight (internally count(1)), so it includes every row in the group. With one or more expressions, each argument must be a storable scalar; splatting of link field-refs into multiple columns is supported. The aggregate skips nulls when counting specific columns—only non-null tuples contribute—matching the usual SQL COUNT(expr) semantics. count_distinct and count_distinct_exact count distinct combinations instead of row multiplicity.
Domain
This is an aggregate function (aggregates rows over a group in aggregate verbs).
This is a window function (calculates over a group of multiple input rows using windowing).
Categories
Examples
statsby events:count(), group_by(customer_id)
Counts every row per customer_id using count() without arguments, equivalent to counting a constant per row.
statsby ok_events:count(error_code), group_by(region)
Counts rows where error_code is non-null per region, illustrating count with an expression so null codes are excluded.
Updated about 17 hours ago