Common Aggregates
Please read the overview for important information on how to accelerate aggregate queries.
Count
COUNT
tallies the number of matching rows/documents from the table.
For ParadeDB Enterprise: Because COUNT(*)
does not specify any fields, you do not need to worry about passing a fast field to COUNT
if *
is used.
Average
AVG
calculates the mean of the specified numeric field values across all documents.
Sum
SUM
computes the total sum of the specified numeric field values across all documents.
Min
MIN
finds the smallest value for the specified numeric field across all documents.
Max
MAX
finds the largest value for the specified numeric field across all documents.
Cardinality
COUNT(DISTINCT)
returns the number of unique values in a field. This is also known as a cardinality aggregation.
Histogram
The following query creates buckets of size 1
for the rating
field. Each field value is rounded down to its bucket.
This query increases the bucket size to 2
.
Other Aggregates
While the above list of aggregates is non-exhaustive, the answer to any kind of aggregate in ParadeDB is to just write SQL. Any aggregate that can be expressed in SQL can be written in ParadeDB.
Was this page helpful?