dcount

Table of Contents

Aggregate Function

dcount — count distinct input values

Synopsis

dcount(any) -> uint64

Description

The dcount aggregation function uses hyperloglog to estimate distinct values of the input in a memory efficient manner.

Examples

Count of values in a simple sequence:

dcount(this)
1
2
2
3 
Loading...

Continuous count of simple sequence:

yield dcount(this)
1
2
2
3 
Loading...

Mixed types are handled:

yield dcount(this)
1
"foo"
10.0.0.1 
Loading...

The estimated result may become less accurate with more unique input values:

seq 10000 | super -z -c 'dcount(this)' -

=>

9987(uint64)

Count of values in buckets grouped by key:

dcount(a) by k | sort
{a:1,k:1}
{a:2,k:1}
{a:3,k:2} 
Loading...
Next: fuse

SuperDB